我正在尝试在XML中创建一个TabLayout作为用户配置文件页面。实质上,我想在3个不同的选项卡上显示文字,文字将根据Firebase中的动态数据进行更新。这是我的代码,它不是呈现我的第一个选项卡。我基本上是瞄准了如下设计:在渲染过程中提出无法在XML中创建TabLayout
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/tabcontent">
<TabHost android:id="@+id/tab_host"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TabWidget android:id="@android:id/tabs"
android:layout_width="wrap_content"
android:layout_height="fill_parent" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEST"/>
</TabWidget>
</TabHost>
</FrameLayout>
而我认为你的答案可能会工作,我主要使用选项卡作为XML和我要去的地方动态文本在选项卡内(它将根据与Firebase的交互进行更新)。我实际上并不需要recylerview功能,这些标签仅仅显示与配置文件屏幕相似的内容。 – tccpg288