Я столкнулся с этой проблемой при обновлении фона, чтобы использовать изображение с 9 патчами. Макет отлично подходит для разных экранов с использованием разных размеров одного и того же изображения, но когда я меняю изображение на 9-патч, он таинственным образом разбивает весь макет.Разметка Android сломана с фоном с 9 патчами
предыдущий макет выглядит следующим образом:
Original layout http://onik.org/android/layoutOk.png.
При изменении 9-заплатки:
9-Patch image http://onik.org/android/layoutError.png.
Файл XML остался прежним, только файлы PNG были изменены.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg">
<TextView
android:text="@string/title"
android:id="@+id/login_title"
android:layout_width="fill_parent"
android:layout_height="40px"
android:textSize="30px">
</TextView>
<View
android:id="@+id/login_underline"
android:layout_width="wrap_content"
android:layout_height="2px"
android:background="#aaaaaa">
</View>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:stretchColumns="1"
android:gravity="center"
android:paddingLeft="10px"
android:paddingRight="10px">
<TableRow>
<TextView
android:id="@+id/login_usernameLabel"
android:text="@string/login_usernameLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="5px">
</TextView>
<EditText
android:text=""
android:id="@+id/login_username"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:lines="1"
android:nextFocusDown="@+id/login_password">
</EditText>
</TableRow>
<TableRow>
<TextView
android:id="@+id/login_passwordLabel"
android:text="@string/login_passwordLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
<EditText
android:text=""
android:id="@+id/login_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:nextFocusDown="@+id/login_login"
android:inputType="textPassword">
</EditText>
</TableRow>
<TableRow android:gravity="right">
<Button
android:text="@string/login_login"
android:id="@+id/login_login"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</Button>
</TableRow>
<TableRow>
<CheckBox
android:id="@+id/login_remember"
android:text="@string/login_remember"
android:layout_span="2">
</CheckBox>
</TableRow>
</TableLayout>
</LinearLayout>
Любые идеи? Или другие решения для получения немасштабированного, центрированного фона?
Не могли бы вы повторно загружать изображения здесь как inline-изображения? В настоящее время они отсутствуют на вашем сайте, что делает этот вопрос немного менее удобочитаемым. –
О, извините, я забыл, что они были связаны здесь. Я попытаюсь посмотреть, есть ли у меня старые резервные копии дома, но я думаю, что они ушли ... – onik
Вы спасли мой день. Это было очень сложно отладить. СПАСИБО !!! –