我使用的是 s4 Galaxy,我下载了以下壁纸壁纸 http://www.sswallpaper.com/get/samsung-galaxy-s4-wallpapers/Keep-Running-1080x1920/595-2.jpg我尝试使用此壁纸作为背景图像,但该图像不适合我的屏幕。如何调整大小以适合我的应用程序的屏幕尺寸?
这是我的 Xml 代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/walking" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="WELCOME"
android:textSize="40dp"
android:textColor="@color/textColor"
android:textStyle="bold"
android:typeface="serif"
android:id="@+id/textView5"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="45dp" />
<TextView
android:layout_width="189dp"
android:layout_height="50dp"
android:text="SKIP"
android:textSize="20dp"
android:textColor="@color/textColor"
android:textStyle="bold"
android:typeface="serif"
android:gravity="center"
android:id="@+id/skip"
android:onClick="click"
android:clickable="true"
android:layout_gravity="bottom"
android:layout_alignParentBottom="true"
android:layout_toStartOf="@+id/textView5" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="To skip the tutorial press SKIP at the bottom.Slide to the left to continue to tutorial page."
android:id="@+id/textView3"
android:textColor="@color/textColor"
android:layout_below="@+id/textView5"
android:layout_centerHorizontal="true"
android:layout_marginTop="90dp" />
</RelativeLayout>
Screenshot of the Image I getting
如果你不希望你的图像缩放......那么你应该使用..
android:scaleType="centerCrop"
Edit:
你应该使用 FrameLayout 来实现这种布局,就像这样......
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerCrop"
android:src="@drawable/walking"/>
<LinearLayout
android:id="@+id/contentLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
.......
</LinearLayout>
</FrameLayout>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)