是否有一种简单的方法可以在Android Studio预览的ViewSwitcher中的显示视图之间进行切换,还是唯一一次可以为子视图交换XML的唯一方法?
不幸的是,Android Studio上没有XML属性或任何选项可以帮助您定义显示的视图。
ViewFlipper
有人在这里问了类似的问题(它们都是的直接子类ViewAnimator
)。
但是,当且仅当视图的大小与screen一样大时,才可以使用include
标记,例如:
<ViewSwitcher
android:id="@+id/myViewSwitcher"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
layout="@layout/first_view">
</include>
<include
layout="@layout/second_view">
</include>
</ViewSwitcher>
然后,您可以在单独的XML文件中查看布局。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句