gpt4 book ai didi

android - 'android:animateLayoutChanges="true"' 是否仍然有效

转载 作者:行者123 更新时间:2023-11-29 17:15:59 26 4
gpt4 key购买 nike

我看到在 xml 布局中使用的这个语句会自动为您制作动画。我想将它添加到我的应用程序中,但是当我将它放入我想要的布局中时

   <LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/arrow_background"
android:layout_marginTop="7dp"
android:layout_marginBottom="7dp"
android:padding="10dp"
android:animateLayoutChanges="true"
android:visibility="visible"
android:id="@+id/format_help">

然后我将可见性更改为消失

view.findViewById(R.id.format_help).setVisibility(View.GONE);

它只会立即消失。我看到的这方面的信息是几年前的,所以有人知道这是否仍然有效或如何让它发挥作用吗?

编辑:我还在各处添加了这条语句,但它仍然不起作用。如果重要的话,这是在 fragment/对话框中

最佳答案

它适用于具有 android:animateLayoutChanges="true"属性的容器内的 View 。如果线性布局具有上述属性,则无论何时从该容器中添加或删除新 View ,效果都是可见的。添加或删除容器时,容器本身将看不到动画效果。有关更多信息,请查看以下链接。 usage of animateLayoutChanges

关于android - 'android:animateLayoutChanges="true"' 是否仍然有效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39010617/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com