Ура за картинки! Вот как это выглядит при назначении картинки фону, а когда нет.
![enter image description here](https://i.stack.imgur.com/HfgqO.png)
![enter image description here](https://i.stack.imgur.com/gChQ9.png)
Я бы очень хотел, чтобы верх не растягивался TableView
, если изображение больше таблицы. Я включил пустое «представление», чтобы уже дать немного больше места фону таблицы, как вы можете видеть в следующем XML. Пытался возиться со ScaleType, но это была стирка.
Как я могу заставить BG растягиваться, чтобы соответствовать макету? Я пытаюсь справиться с тем, что «у пользователя ххх экран меньше, чем у WVGA». Мне не хватает изящества, по-видимому.
<TableLayout
android:id="@+id/widget29"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:scaleType="fitXY"
android:background="@drawable/minetownx480"
>
<View
android:id="@+id/blankSpace"
android:layout_width="fill_parent"
android:layout_height="60dip" />
<TableRow android:id="@+id/widget40" android:layout_width="fill_parent" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal">
<TextView android:id="@+id/moneyText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Money: $$$$$$$$$" />
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/savingsText" android:gravity="right" android:text="Savings: $$$$$$$" android:layout_weight="3" android:textSize="12sp"/>
</TableRow>
<TableRow android:id="@+id/widget41" android:layout_width="fill_parent" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal">
<TextView android:id="@+id/wagonText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Wagon Space: XXX/XXX" />
<TextView android:id="@+id/loanText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Loans: $$$$$$$$" android:gravity="right" android:layout_weight="3" android:textSize="12sp"/>
</TableRow>
<TableRow android:id="@+id/widget42" android:layout_width="fill_parent" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" >
<TextView android:id="@+id/daysText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Days Left: XX/XX" />
<TextView android:id="@+id/armedText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Unarmed!" android:gravity="right" android:layout_weight="3" />
</TableRow>
</TableLayout>
Tablelayout - это первый элемент корневого linearLayout, если это вообще имеет значение.
Редактировать: В качестве альтернативы, если вы знаете, как я мог измерить пространство X и Y tableLayout до назначения изображения, я мог бы масштабировать его программно, прежде чем назначить его ... Любое решение было бы хорошо, если кто-нибудь знает!