0
我为每个标签设置了一个图片,其结果与预期的一样,但在某些设备(平板电脑或某些智能手机型号)上图片看起来更大,文字更大。如何解决它?谢谢。安卓缩放标签图片
活动,
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>
有在您的各种绘制的文件夹特定的分辨率的图像。 – Swayam 2012-07-12 09:18:16
ummm不!我应该为每个密度生成不同的分辨率,不是吗?如果是的话,你能告诉我每个密度的图像大小优化吗? – Jaume 2012-07-12 09:24:11
嗯,如果你在Eclipse中创建一个新的项目,你会发现图标默认添加到可绘制的文件夹中。我建议你只使用这些尺寸。 – Swayam 2012-07-12 09:41:56