【发布时间】:2017-08-25 07:26:20
【问题描述】:
我正在开发一个应用程序,我需要用背景填充整个屏幕,这个视图包含一个滚动视图。问题是背景没有覆盖整个屏幕,它在底部有一条白色条纹,如下图所示。
我已经尝试了许多 scaleType 选项,例如 fitXY、centerInside 等,但都没有成功。 我的 XML 在下面。
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/signup_background" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="40dp">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/image_view_photo"
android:layout_width="130dp"
android:layout_height="130dp"
android:layout_gravity="center"
android:layout_marginBottom="25dp"
android:src="@drawable/camera_icon" />
<android.support.v7.widget.AppCompatEditText
android:id="@+id/edit_text_name"
style="@style/BaseEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/name_icon"
android:hint="@string/field_name"
android:inputType="textCapWords" />
<android.support.v7.widget.AppCompatEditText
android:id="@+id/edit_text_email"
style="@style/BaseEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/email_icon"
android:hint="@string/field_email"
android:inputType="textEmailAddress" />
<android.support.v7.widget.AppCompatEditText
android:id="@+id/edit_text_password"
style="@style/BaseEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/password_icon"
android:hint="@string/field_password"
android:inputType="textPassword" />
<android.support.v7.widget.AppCompatEditText
android:id="@+id/edit_text_confirm_password"
style="@style/BaseEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="35dp"
android:drawableLeft="@drawable/password_icon"
android:hint="@string/field_confirm_password"
android:inputType="textPassword" />
<com.jacksonueda.reachalert.Utils.LoadingButton
android:id="@+id/btn_signup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:text="@string/action_sign_up" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
</ScrollView>
谁能帮帮我?谢谢。
【问题讨论】:
标签: android xml background fullscreen