我正在尝试为我的应用设置标签.但是,在我完成UI后,点击选项卡会导致按钮和标签同时出现.例如,Tab1显示一个按钮.当我点击Tab2时,按钮出现在Tab2上.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TabHost
android:id="@+id/tabhost"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="254dp"
android:layout_height="25dp" >
</TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="@+id/tabPower"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hear" />
<SeekBar
android:id="@+id/sb"
android:layout_width="253dp"
android:layout_height="wrap_content" />
<ToggleButton
android:id="@+id/tb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:text="ToggleButton" />
</LinearLayout>
<LinearLayout
android:id="@+id/tabEq"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:orientation="horizontal" >
<CheckBox
android:id="@+id/enabled"
android:layout_width="105dp"
android:layout_height="wrap_content"
android:layout_gravity="fill"
android:layout_weight="1"
android:text="@string/enabled" />
<Button …Run Code Online (Sandbox Code Playgroud)