Android layout AnimateLayoutChanges属性禁用子元素的alpha属性
将animatedLayoutChanges=“true”添加到父布局时,子布局中的alpha不再起作用:Android layout AnimateLayoutChanges属性禁用子元素的alpha属性,android-layout,android-xml,Android Layout,Android Xml,将animatedLayoutChanges=“true”添加到父布局时,子布局中的alpha不再起作用: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:ani
<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>
/我猜animatedLayoutChanges使用keepLastFrame=true的AlphaAnimation,它正在编辑预先确定的alpha。
我从来没有这样做过,但也许你可以尝试设置动画监听器,并在最后重置你想要的alpha。(请注意,动画监听器在三星设备上有一个bug,它可能根本不会被调用)