我想让用户知道他使用标签的应用程序页面。因此,如果他在第一页上页面一个标签将被点亮,如果他在第二页,页面两个标签将被点亮等。但我想要它,以便标签没有任何功能。它们在所有页面上保持相同(执行点亮的内容)并且没有触摸/点击事件。我应该使用标签还是有更好的选择?我如何通过选项卡实现更好的选择呢?提前致谢
答案 0 :(得分:1)
执行此操作的最佳方法可能是避免完全使用制表符小部件,只需使用排列在像LinearLayout这样的容器中的TextView来自行滚动。
<?xml version="1.0" encoding="utf-8"?>
<!-- Top-level layout for page -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- Tab Bar -->
<LinearLayout
android:id="@+id/tab_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<!-- Tab 1 -->
<TextView
android:id="@+id/tab_bar_file"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/file_label"/>
<!-- Tab 2 -->
<TextView
android:id="@+id/tab_bar_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit_label"/>
<!-- More tabs go here -->
</LinearLayout>
<!-- Page content goes here -->
</LinearLayout>
关于此的一些注意事项:
<include>
指令
它适用于任何需要的布局
显示标签。