gpt4 book ai didi

android - 在 Android Studio 中预览 View 切换器

转载 作者:IT老高 更新时间:2023-10-28 23:35:21 24 4
gpt4 key购买 nike

是否有一种简单的方法可以在 Android Studio 预览中的 ViewSwitcher 中的显示 View 之间进行切换,或者是一次将 XML 换成 subview 的唯一方法?

最佳答案

不幸的是,Android Studio 上没有 XML 属性或任何选项可以帮助您定义显示的 View 。

ViewFlipper 的一个类似问题被问到 here (它们都是 ViewAnimator 的直接子类)。

但是,当且仅当您的 View 与屏幕一样大,您可以使用 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 文件中查看您的布局。

关于android - 在 Android Studio 中预览 View 切换器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30084121/

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