天天看點

【TabHost】Android設定TabHost文字及圖檔

Android TabHost 文字及圖檔的設定

TabWidget tabWidget=myTabhost.getTabWidget();//設定字型顔色

        for(int i=0;i<tabWidget.getChildCount();i++){

                    //設定顯示文字

            TextView tv=(TextView)tabWidget.getChildAt(i).findViewById(android.R.id.title);

                   //設定顯示圖檔            ImageView iv=(ImageView)tabWidget.getChildAt(i).findViewById(android.R.id.icon);

            iv.setPadding(0, 10, 0, 0);

            tv.setPadding(0, -5, 0, 0);

            tv.setTextColor(Color.BLACK);

        }