线性布局的背景图像尺寸不是很好
问题描述:
我做了一个带有背景图像,PNG的线性布局...我不知道如何将它显示到布局(和居中)保持比例...这里是代码线性布局的背景图像尺寸不是很好
<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/background">
显然图像具有相同的高度和宽度的显示...任何帮助?在此先感谢
= .4.S。=
答
谢谢大家^^我这样解决:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/background"
android:layout_gravity="center"/>
<ListView android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="#FFFFFF"
android:layout_weight="2"
android:drawSelectorOnTop="false"
android:layout_gravity="center"/>
</FrameLayout>
是图像被显示出来歪斜(错误的比例),不填充的LinearLayout的整个区域的问题,不居中,或者一些三者的结合? – plainjimbo 2011-06-06 20:48:42
好吧,图像填充整个区域并居中,但比例错误,因为它锚定在布局上... – Erenwoid 2011-06-06 20:54:39