I’ve got a very simple TableLayout inside a RelativeLayout. One of the rows contains a spinner which is set to “fill_width“. In the emulator this looks as it should, but on my phone it’s a couple of pixels away from full width on both left and right. The next rows in the table fill as they should. Also tried moving the spinner outside the table, but it didn’t change anything…
Anyone got any tips?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="0"
android:shrinkColumns="0"
>
<TableRow>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_span="3"
android:layout_marginTop="10dip"
android:text="@string/project_prompt"
/>
</TableRow>
<TableRow>
<Spinner
android:id="@+id/spinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_span="3"
android:prompt="@string/project_prompt"
/>
</TableRow>
<TableRow>
<Button
android:id="@+id/button_addproject"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1"
android:text="Ny"
android:onClick="selfDestruct"
/>
<Button
android:id="@+id/button_modifyproject"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1"
android:text="Rediger"
android:onClick="selfDestruct"
/>
<Button
android:id="@+id/button_deleteproject"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1"
android:text="Slett"
android:onClick="selfDestruct"
/>
</TableRow>
</TableLayout>
<Button
android:id="@+id/button_connect"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_centerInParent="true"
android:text="@string/connect"
/>
<ImageView
android:src="@drawable/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
/>
</RelativeLayout>
I don’t have a solution but can confirm that. I just checked it in one of my own apps on my device and the emulator. It’s not really that bad in my case but you can see the difference.
I assume it’s the nature of the system UI. I think the spinner is using a 9 patch image and if this one defines a padding there’s not much you can do I think. E.g. a button behaves the same way on my device.