那位大虾,知道,android:TabHost,选项卡的,文字居中。270781058

2025-05-08 17:13:03
推荐回答(3个)
回答1:

给TAB卡做个布局,在布局里面把TextView设置成居中
给个事例给你看下
TabHost.TabSpec localTabSpec1 = this.tabHost.newTabSpec("1");
//R.Layout.tab_indicator 就是TAB选项卡的布局
View localView = getLayoutInflater().inflate(R.layout.tab_indicator, null);
ImageView localImageView = (ImageView) localView.findViewById(R.id.icon);
localImageView.setImageResource(R.drawable.menu_ranking);
TabHost.TabSpec localTabSpec2 = localTabSpec1.setIndicator(localView);
Intent localIntent = new Intent(this, RankActivity.class);
localTabSpec2.setContent(localIntent);
this.tabHost.addTab(localTabSpec1);

回答2:

查查API文档看看

回答3:

android:gravity="center"不行吗?