Cod*_*ile 14 android android-animation android-layout android-listview
我正在使用一个ViewSwitcher,它可以让我轻松地在内置动画的两个不同的List Headers之间来回切换.
然而,问题是两个视图的高度变化很大,看起来ViewSwitcher用来layout_height="wrap_content"测量两个孩子并将两个高度中较大的一个视为自己的高度.当显示时,这会在较小视图的正下方产生大量不需要的空白区域.
我理解为什么这是理想的ViewSwitcher行为,但它不希望My App行为.
示例:
Say View A高50dp,View B高100dp,两者都作为子项添加到ViewSwitcher.即使View A显示,ViewSwitcher总是高达100dp.
我想要的是能够在A和B之间切换并使ViewSwitcher缩小或增长以适合当前显示的任何视图.我怎样才能做到这一点?
bal*_*azs 41
measureAllChildren在ViewSwitcherto 上设置属性false.
<ViewSwitcher
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:measureAllChildren="false">
Run Code Online (Sandbox Code Playgroud)
欲了解更多信息请参阅文档.
| 归档时间: |
|
| 查看次数: |
2746 次 |
| 最近记录: |