1

ここに画像の説明を入力してください

GPSと地図を使ったアプリを自分でデザインしています。UIをタブとして作成しました。しかし、画像の下にフォントを保持することができませんでした。

私の主な活動のコード

TabSpec gpsspec = tabHost.newTabSpec("GPS");
gpsspec.setIndicator("GPS", getResources().getDrawable(R.drawable.gps));
Intent gpsIntent = new Intent(this, GpsActivity.class);
gpsspec.setContent(gpsIntent);
tabHost.addTab(gpsspec);

タブ用のドローアブルフォルダ内の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/gps_icon"
          android:state_selected="true" />
    <!-- When not selected, use white-->
    <item android:drawable="@drawable/gps_icon" />
</selector>

Main.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:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >

        <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>

フォントの配置にご協力ください。

4

1 に答える 1

3

提供する必要があります

  • drawable-ldpiフォルダー内の密度の小さいデバイスのアイコンのサイズが小さい
  • drawable-mdpiフォルダ内の中密度デバイス用の中サイズのアイコン
  • drawable-hdpiフォルダー内の大容量デバイスの大きいサイズのアイコン

これは、ドローアブルとレイアウトのサイズに関するドキュメンテーション ガイドです。

問題が解決しない場合は、独自のカスタマイズされたタブ インジケーターを提供することを検討してください

于 2012-03-08T08:56:38.603 に答える