❶ android 怎么设置TabHost默认显示的选项卡为选中状态
给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);