我有一个这样的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,我希望降低图像高度)。
此后它应该是什么样子:
任何人都知道如何做到这一点?
谢谢 !!