【发布时间】:2011-05-04 17:33:10
【问题描述】:
我有一个选项卡布局,其中包含可绘制资源作为选项卡图像。 在横向模式下一切正常。但在纵向模式下,图像没有标签页边距。如何更改图像比例或如何为图像设置一些边距?我不想使用固定大小,不要认为这是正确的方式。
这是我的布局
<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"
android:padding="5dp"
>
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</FrameLayout>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/logo" android:state_selected="true" />
<item android:drawable="@drawable/logo_disabled" />
</selector>
这里是标签创建
Drawable d = res.getDrawable(R.drawable.logos);
spec = tabHost.newTabSpec(1).setIndicator("", res.getDrawable(R.drawable.logos)).setContent(intent);
tabHost.addTab(spec);
【问题讨论】:
标签: android layout tabs margin scale