【发布时间】:2014-01-30 13:48:06
【问题描述】:
我需要将 tabhost 的 Title 设置为两行。 当我选择选项卡时,我将全文作为自动滚动的东西查看,但我需要它以两行显示,以便它始终可以完全查看。有人可以帮忙吗!
public class Tabs extends Activity implements OnClickListener {
TabHost th;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.tabs);
th = (TabHost) findViewById(R.id.tabhost);
th.setup();
TabSpec specs = th.newTabSpec("tag1");
specs.setContent(R.id.tab1);
specs.setIndicator("Large Text");
//That is i need to put "Large" in one line and "Text" in next line in the title of the tabhost
th.addTab(specs);
specs = th.newTabSpec("tag2");
specs.setContent(R.id.tab2);
specs.setIndicator("Small");
th.addTab(specs);
specs = th.newTabSpec("tag3");
specs.setContent(R.id.tab3);
specs.setIndicator("TEXT");
th.addTab(specs);
specs = th.newTabSpec("tag4");
specs.setContent(R.id.tab4);
specs.setIndicator("TXET");
th.addTab(specs);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
}
【问题讨论】:
标签: android android-tabhost android-tabs