Rom*_*man 1 android viewswitcher
我像这样使用ViewSwitcher:
<ViewSwitcher
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/content_popup"
android:visibility="invisible"
android:layout_centerInParent="true">
<include layout="@layout/content_popup_stub" android:id="@+id/content_general"/>
<include layout="@layout/video_select_popup_stub" android:id="@+id/content_select_video"/>
</ViewSwitcher>
Run Code Online (Sandbox Code Playgroud)
并计划在该ViewSwitcher中再使用4个子级。现在,如何使用.showNext()或.showPrevious()在 view1和view4或view1和view3之间切换?有没有办法设置下一个或上一个视图?
此处找到文档:
http://developer.android.com/reference/android/widget/ViewSwitcher.html
声明视图切换器是在2个视图(不超过2个)之间切换的组件。如果您想在2个以上的视图之间切换,那么我建议您使用ViewFlipper
http://developer.android.com/reference/android/widget/ViewFlipper.html
这是从ViewAnimator扩展的。它有一个方法叫做setDisplayedChild
(http://developer.android.com/reference/android/widget/ViewAnimator.html#setDisplayedChild(int))
您可以使用它在不同的视图之间制作动画。它的实现与ViewSwitcher几乎相同。
希望这可以帮助。
| 归档时间: |
|
| 查看次数: |
2857 次 |
| 最近记录: |