【问题标题】:animateLayoutChanges animates elements separately even though they're in a ViewGroupanimateLayoutChanges 单独为元素设置动画,即使它们位于 ViewGroup 中
【发布时间】:2015-07-12 09:14:13
【问题描述】:

我想将 ViewGroup (LinearLayout) 从 GONE 设置为 VISIBLE。 ViewGroup 包含两个元素,它们分别获得动画。是否可以以动画将它们视为一个元素的方式将它们“分组”?

【问题讨论】:

    标签: java android animation


    【解决方案1】:

    给你的 LinearLayout 一个 id 并添加 android:visibility="invisible"。然后将它初始化为你的类中的一个对象:

    LinearLayout ll = (LinearLayout) findViewById(R.id.ll_id);
    

    然后只需使用ll.setVisibility(View.VISIBLE);

    【讨论】:

    • 如果视图是invisible,它仍然会在布局中占用空间。目前我基本上只对android:visibility="gone"做同样的事情。
    猜你喜欢
    • 2014-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-14
    • 1970-01-01
    • 1970-01-01
    • 2015-05-16
    相关资源
    最近更新 更多