我为每个标签设置了一个图像,结果与预期一致,但在某些设备(平板电脑或某些智能手机型号)上,图像看起来更大,也更高于文字。怎么解决?谢谢。
活性,
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>
答案 0 :(得分:0)
我相信这些链接可以指导您正确解决问题。
http://developer.android.com/guide/practices/screens_support.html
http://coding.smashingmagazine.com/2011/06/30/designing-for-android/
http://www.coronalabs.com/blog/2011/01/27/dynamic-image-resolution-made-easy/
另外,这个问题提出了一个与我相似的问题。
Determining image sizes for multiple android screen sizes/densities