❶ 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);