0

TabActivityでListActivityを表示しようとしていますが、何らかの理由でListActivitiesが表示されません。私が得るのは、タブの下の空白だけです。

TabActivity:https ://picasaweb.google.com/FlyingYellow/Misc#5629459368100202146 ListActivity: https : //picasaweb.google.com/FlyingYellow/Misc#5629459406832281026

なぜこれが起こっているのか、私にはまったくわかりません。私は周りを検索しましたが、入力の問題に関する投稿しか見つかりませんでした。コンテンツを表示することすらできません。

TabActivity.onCreate()

 super.onCreate(savedInstanceState);
 setContentView(R.layout.browser);


 Resources res = getResources();
 TabHost tabHost = getTabHost();
 TabHost.TabSpec spec;
 Intent intent;


 intent = new Intent(this, ArtistBrowser.class);

 spec = tabHost.newTabSpec("artists").setIndicator("Artists", res.getDrawable(R.drawable.ic_tab_artists));
 spec.setContent(intent);

 tabHost.addTab(spec);

 intent = new Intent(this, AlbumBrowser.class);
 spec = tabHost.newTabSpec("albums").setIndicator("Albums", res.getDrawable(R.drawable.ic_tab_artists));
 spec.setContent(intent);

 tabHost.addTab(spec);

 intent = new Intent(this, TrackBrowser.class);
 spec = tabHost.newTabSpec("tracks").setIndicator("Tracks", res.getDrawable(R.drawable.ic_tab_artists));
 spec.setContent(intent);

 tabHost.addTab(spec);

 tabHost.setCurrentTab(0);

(私はAndroidドキュメントのチュートリアルに従いました)

/res/layout/browser.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="match_parent"
    android:layout_height="match_parent">

  <LinearLayout
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:padding="5dp">
    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />    <--- this was the error
    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="5dp" />
  </LinearLayout>
</TabHost>
4

1 に答える 1

1

もう一度、私は私がばかであることを発見しました。他の誰かがこのエラーに遭遇した場合に備えて、私の問題は、TabWidgetの高さを考えずにmatch_parentに設定したことでした。TabWidgetとFrameLayoutを異なる色にすることでこれを理解し、画面全体が赤であることがわかりました。キリストよ、私はもっと注意する必要があります。

于 2011-07-16T03:01:03.097 に答える