在Android上是否有一种声明性的方式来创建选项卡式布局?
演示了如何使用大量重复的过程代码向TabHost添加选项卡 在Android上是否有一种声明性的方式来创建选项卡式布局?像下面这样的在Android上是否有一种声明性的方式来创建选项卡式布局?,android,tabs,android-layout,tabbed-interface,tabbed-view,Android,Tabs,Android Layout,Tabbed Interface,Tabbed View,演示了如何使用大量重复的过程代码向TabHost添加选项卡 在Android上是否有一种声明性的方式来创建选项卡式布局?像下面这样的 <?xml version="1.0" encoding="utf-8"?> <TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Tab android:text="Artists"
android:icon="@drawable/ic_tab_artists"
android:href="artists_frame"/>
<Tab android:text="Albums"
android:icon="@drawable/ic_tab_albums"
android:href="albums_frame"/>
<Tab android:text="Songs"
android:icon="@drawable/ic_tab_songs"
android:href="songs_frame"/>
</TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<TextView android:id="artists_frame"
android:text="This is the Artists tab."/>
<TextView android:id="albums_frame"
android:text="This is the Albums tab."/>
<TextView android:id="songs_frame"
android:text="This is the Songs tab."/>
</FrameLayout>
</LinearLayout>
</TabHost>
(如果存在此错误,FrameLayout一次只能显示一个子视图。)不幸的是,否。(我以前遇到此错误:正文必须至少30个字符;您输入了18)不幸的是,否。(我以前遇到此错误:正文必须至少30个字符;您输入了18)