私はAndroidが初めてで、2つのタブウィジェットでタブホストを作成していましたが、すべてうまくいき、2つのタブで2つの異なるアクティビティを表示しています.しかし、問題は、2つの異なるタブに指定しているテキストが下に来ていることです.アプリを実行しています。以下に、理解のためにスクリーンショットを入れています
スクリーンショット:
テキストは赤でマークされているので、そのテキストを中央に揃える方法はありますか。もう1つ、ユーザーのクリックのさまざまな状態に描画可能な画像を使用しています。助けてくれてありがとう。
タブホストの xml ファイル
<?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"
>
<include layout="@layout/top_portion_layout"/>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
>
</TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#808080">
</FrameLayout>
</LinearLayout>
</TabHost>
この部分は別のレイアウトで、2 つのボタンがすべて同期され、このレイアウトに含まれています。