如何实现背景图像不会在线性布局上拉伸



我有一个带有背景图像的线性布局。 在创建线性布局之前,我需要滚动视图。 在我这样做之后,我的线性布局上的图像被拉伸了。 你能帮我创建我的图像,这样它就不会被拉伸吗?

这是我的代码.xml

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height= "wrap_content"
android:gravity="center_horizontal"
android:background="@drawable/bg_image_login"
android:orientation="vertical"
android:windowSoftInputMode="stateVisible|adjustResize"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.fania.suara_project.LoginActivity">
<ImageView
android:id="@+id/haha"
android:background="drawable/bg_image_login"
android:scaleType="fitXY"
android:layout_width="match_parent"
android:layout_height="match_parent" />

</LinearLayout>

请帮帮我。谢谢:)

放置滚动视图背景

android:background="@drawable/bg_image_login"

而不是线性布局。

最新更新