私のアプリケーションでは、タブホストアクティビティを使用して、タブに画像を設定します。アプリケーションがエミュレーターで実行されている間、画像は問題なく表示されます。しかし、モバイル(Micromax mobile)でアプリケーションを実行している間は表示されません。
何が問題なのか、どうやって解決するのか教えてください。
タブホストコーディング:
Intent intent = new Intent(this, WeekActivity.class);
tabHost.addTab(tabHost
.newTabSpec("Week")
.setIndicator("Weekly", res.getDrawable(R.drawable.ic_tab_main))
.setContent(intent));
Intent intent2 = new Intent(this,ListMonthActivity.class);
tabHost.addTab(tabHost
.newTabSpec("Month")
.setIndicator("Monthly", res.getDrawable(R.drawable.ic_tab_setup))
.setContent(intent2));
tabHost.setCurrentTab(0);
Intent intent3 = new Intent(this, ListYearActivity.class);
TabHost.TabSpec spec=tabHost.newTabSpec("Year").setIndicator("Yearly",getResources().getDrawable(R.drawable.ic_launcher)).setContent(intent3);
tabHost.addTab(spec);
/*tabHost.addTab(tabHost
.newTabSpec("Year")
.setIndicator("Yearly", res.getDrawable(R.drawable.ic_tab_setup))
.setContent(intent3));
tabHost.setCurrentTab(0);*/
// Set tabs Colors
tabHost.setBackgroundColor(Color.BLACK);
tabHost.getTabWidget().setBackgroundColor(Color.BLACK);
}
セレクタータブホストXmlファイル
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- When selected, use grey -->
<item android:drawable="@drawable/calendaricon"
android:state_selected="true"/>
<!-- When not selected, use white-->
<item android:drawable="@drawable/calendaricon2" />
</selector>
タブホストレイアウトXMLファイル:
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:padding="0dp"
>
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent" android:layout_height="wrap_content"
/>
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent" android:layout_height="fill_parent"
/>
</LinearLayout>
</TabHost>