【发布时间】:2013-01-17 01:49:54
【问题描述】:
我有一个这样的 RelativeLayout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/favoriteLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/background1"
>
....
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/background2"
android:layout_below="@+id/linearLayout1"
>
....
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/background3"
android:layout_below="@+id/linearLayout2"
>
....
</LinearLayout>
</RelativeLayout>
我想在三个 LinearLayout 中的每一个中都有一个不同的背景图像,并且这个图像应该被缩放以填充它的 LinearLayout 而不保留图像的纵横比。而且我不希望每个LinearLayout都被缩放以适应图像的大小(如果图像高于LinearLayout,我希望降低图像高度)。
以后应该是什么样子:
有人知道怎么做吗?
谢谢!!
【问题讨论】:
标签: android xml image android-linearlayout android-framelayout