neh*_*eha 18
以下代码为我工作:
tabHost.getTabWidget().setBackgroundResource(R.drawable.tabhost_bg);
Run Code Online (Sandbox Code Playgroud)
Pin*_*nki 10
试试这个
getTabHost().addTab(getTabHost().newTabSpec("A")
//set the tab name
.setIndicator("A")
//Add additional flags to the intent (or with existing flags value).
.setContent(new Intent(this, A.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));
//for creating tab we need to pass tabSpec and tab name to setIndicator and pass intent to its
//setContent to Tab Activity predefined method getTabHost then it will create tab
getTabHost().addTab(getTabHost().newTabSpec("B")
//set the tab name
.setIndicator("B")
//Add additional flags to the intent (or with existing flags value).
.setContent(new Intent(this,B.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)) );
getTabHost().addTab(getTabHost().newTabSpec("C")
//set the tab name
.setIndicator("C")
//Add additional flags to the intent (or with existing flags value).
.setContent(new Intent(this,C.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)) );
getTabHost().getTabWidget().getChildAt(0).setBackgroundResource(R.drawable.a);
getTabHost().getTabWidget().getChildAt(1).setBackgroundResource(R.drawable.b);
getTabHost().getTabWidget().getChildAt(2).setBackgroundResource(R.drawable.c);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17415 次 |
| 最近记录: |