チュートリアルから直接レイアウト XML ファイルがあります。
layout/partnertrial_summary.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"
android:padding="5dp">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" />
</LinearLayout>
</TabHost>
私のActivity
クラスでは、次のコードを使用しようとしましたが、失敗した場合:
mTabHost = findViewById(R.layout.partnertrial_summary.tabhost);
これは失敗します。ただし、緑の部分を検証しますR.layout.partnertrial_summary
が、そのメンバーを自動ポップアップしようとするpartnertrial_summary
と何も得られません。
XMLはAndroidから直接来たので有効だと思います。それは私が間違っていることです。myActivity
は ではありませんがTabActivity
、通常のものを使用して を追加しTabHost
、適切なリスナーを実装しても問題ないと思いました。私の考えが間違っていたら訂正してください。