2011-07-15 1 views
0

TabActivityにListActivityを提示しようとしていますが、何らかの理由でListActivitiesが表示されません。私が得るのは、タブの下に空白のスペースだけです。TabActivityのコンテンツとして追加したときにListActivityが表示されない

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); 

(Iは、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> 

答えて

1

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

関連する問題