AnimateLayoutChanges属性禁用了子元素的alpha属性。

3

当我在父布局中添加animatedLayoutChanges="true"时,子布局的alpha值不再生效:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:animateLayoutChanges="true"> // <<<<<<<

<LinearLayout 
        android:id="@+id/my_outofzoom_text_tablet_landscape"
        android:layout_width="300dp"
        android:layout_marginTop="25dp"
        android:layout_centerHorizontal="true"
        android:layout_height="100dp"
        android:background="@drawable/border_rounded_corner"
        android:layout_toRightOf="@id/movable_layout"
        android:alpha="0.5"        // <<<<<<< 
        android:visibility="gone"
        android:gravity="center"
        android:clickable="true">
    <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:textColor="#ffff"
            android:layout_margin="5dp"
            android:textSize="25dp"
            android:text="@string/to_far_away">

    </TextView>
</LinearLayout>

有人知道为什么会这样,我该怎么办吗?

1个回答

0

我猜测animatedLayoutChanges使用了keepLastFrame=true的AlphaAnimation,这会编辑你预设的alpha值。 我从未尝试过,但也许你可以尝试设置动画监听器,在最后重置你想要的alpha值。(请注意,动画监听器在三星设备上存在一个bug,可能根本不会被调用)


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接