【发布时间】:2011-08-12 04:45:12
【问题描述】:
我以前问过这个问题,但直到现在才知道确切的问题是什么。我的问题是我制作了一个自定义微调器/适配器,并且我将填充设置为 5dip,以便在微调器的行中保持适当的间距。问题是当我添加填充时,我必须使微调器更大以补偿更多的填充。有没有办法可以忽略所选项目的填充。所以当微调器折叠时,填充被忽略,当它展开时,填充被使用。
微调器中的行的 xml:
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dip">
<ImageView
android:layout_width="32sp"
android:src="@drawable/icon"
android:id="@+id/spinnerimage"
android:layout_height="32sp" />
<TextView
android:textSize="22sp"
android:textStyle="bold"
android:textColor="#000"
android:layout_width="fill_parent"
android:id="@+id/category"
android:layout_height="wrap_content"
android:paddingLeft="5sp" />
</TableRow>
</TableLayout>
和微调器:
<Spinner
android:id="@+id/catspinner"
android:layout_marginLeft="25dip"
android:layout_marginRight="25dip"
android:layout_width="fill_parent"
android:layout_centerHorizontal="true"
android:layout_height="wrap_content"
android:prompt="@string/prompt"
android:background="@drawable/yellow_btn"
android:layout_centerVertical="true"
android:drawSelectorOnTop="true" />
【问题讨论】: