XML ファイルから膨張させたタブにコンテンツを設定するのに問題があります。
次のようにして、タブを TabHost (「タブ」) に動的に追加します。
TabSpec passSpec = tabs.newTabSpec("Pass Tab");
passSpec.setIndicator("Passengers", getResources().getDrawable(R.drawable.tab_message));
passSpec.setContent(new TabHost.TabContentFactory() {
public View createTabContent(String tag) {
View layout = mInflater.inflate(R.layout.tab_content_passengers, null);
return(layout);
}
});
tabs.addTab(passSpec);
これはうまくいきます...私が問題を抱えているのは、後でそのタブのコンテンツを変更することです. すべてのタブを新しいレイアウトで再膨張させずにこれを達成する方法はありますか?
私は次のことを試みていますが、何も起こりません:
mInflater = LayoutInflater.from(this);
View layout = mInflater.inflate(R.layout.tab_content_passengers, null);
TextView t = (TextView) layout.findViewById(R.id.testText);
t.setText("Hello world??");