下の画像のように見えるタブをカスタマイズしたかった..どうすればよいか..
デフォルトでは、Android タブは XML での幅と高さの設定をサポートしていません。
これはタブホストの基本的なレイアウトです。
次に例を示します。これをタブホストを保持するアクティビティに配置し、作成後にTabActivityを拡張します。必要なタブの数だけ繰り返します。APIデモは、この基本情報に役立ちます。
ドローアブルアイコンは、ドローアブルフォルダにあるxmlファイルになります。
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- When selected, use white -->
<item android:drawable="@drawable/white"
android:state_selected="true" />
<!-- When not selected, use grey-->
<item android:drawable="@drawable/grey" />
TabHost tabHost = getTabHost();
// Tab 1
TabSpec tab1spec = tabHost.newTabSpec("TAB1 TITLE");
tab1spec.setIndicator("TAB1 TEXT", getResources().getDrawable(R.drawable.tab1iconhere));
Intent tab1Intent = new Intent(this, ActivityforTab1.class);
tab1spec.setContent(tab1Intent);
// Tab 2
TabSpec tab2spec = tabHost.newTabSpec("TAB2 TITLE");
tab2spec.setIndicator("TAB2 TEXT", getResources().getDrawable(R.drawable.tab2iconhere));
Intent tab2Intent = new Intent(this, ActivityforTab2.class);
tab2spec.setContent(tab2Intent);
// Adding all TabSpec to TabHost
tabHost.addTab(tab1spec); // Adding tab1
tabHost.addTab(tab2spec); // Adding tab1