[英]android scale tab image
我為每個選項卡設置了一個圖像,結果與預期的一樣,但是在某些設備(平板電腦或某些智能手機型號)上,圖像顯示為較大且在文本上方。 怎么解決呢? 謝謝。
活動,
StateListDrawable selector = new StateListDrawable();
selector.addState(new int[] { android.R.attr.state_selected }, dSel);
icon.setImageDrawable(selector);
布局,
<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">
<RelativeLayout
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:layout_below="@+id/mainLayout">
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:scrollbars="none"
android:isScrollContainer="false">
</FrameLayout>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
/>
</LinearLayout>
</RelativeLayout>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.