Android 布局设置中的错误

Android 布局设置中的错误,android,android-layout,Android,Android Layout,现在我有一个如图所示的布局,只是我希望白色矩形中的蓝色矩形填充整个白色正方形。。但我试图更改一些设置,但不起作用 Xml是: <merge xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" tools:context=".LoginActivity" > <!-- Login progr

现在我有一个如图所示的布局,只是我希望白色矩形中的蓝色矩形填充整个白色正方形。。但我试图更改一些设置,但不起作用

Xml是:

    <merge xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:tools="http://schemas.android.com/tools"
   tools:context=".LoginActivity" >


    <!-- Login progress -->

    <LinearLayout
       android:id="@+id/login_status"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_gravity="center"
       android:gravity="center_horizontal"
       android:orientation="vertical"
       android:visibility="gone" >

        <ProgressBar
           style="?android:attr/progressBarStyleLarge"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_marginBottom="8dp" />

        <TextView
           android:id="@+id/login_status_message"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_marginBottom="16dp"
           android:fontFamily="sans-serif-light"
           android:text="@string/login_progress_signing_in"
           android:textAppearance="?android:attr/textAppearanceMedium" />
    </LinearLayout>

    <!-- Login form -->

    <ScrollView
       android:id="@+id/login_form"
       android:layout_width="fill_parent"
       android:layout_height="match_parent"
       android:background="@color/background_color" >



        <LinearLayout
           style="@style/LoginFormContainer"
           android:layout_width="fill_parent"
           android:layout_height="wrap_content"
           android:layout_gravity="center_horizontal"
           android:layout_marginTop="20dp"
           android:background="@color/background_login_color"
           android:orientation="vertical" >

        <LinearLayout
       android:id="@+id/row0"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:background="@drawable/top_logo_repeat"
       android:gravity="center"
       android:orientation="vertical" >

        <ImageView
           android:id="@+id/imageLogo"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:antialias="true"
           android:contentDescription="@string/logoimg"
           android:src="@drawable/logo" />

    </LinearLayout>

            <EditText
               android:id="@+id/username"
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:hint="@string/prompt_username"
               android:inputType="textEmailAddress"
                           android:layout_marginTop="20dp"

               android:maxLines="1"
               android:singleLine="true" />

            <EditText
               android:id="@+id/password"
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:hint="@string/prompt_password"
               android:imeActionId="@+id/login"
               android:imeActionLabel="@string/action_sign_in_short"
               android:imeOptions="actionUnspecified"
               android:inputType="textPassword"
               android:maxLines="1"
               android:singleLine="true" />

            <CheckBox
               android:id="@+id/checkBox1"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:text="@string/saveCheckBox" />

            <Button
               android:id="@+id/sign_in_button"
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:layout_marginTop="16dp"
               android:paddingLeft="32dp"
               android:paddingRight="32dp"
               android:text="@string/action_sign_in_register" />

            <Button
               android:id="@+id/button1"
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:layout_toRightOf="@+id/sign_in_button"
               android:layout_weight="0.30"
               android:text="@string/registerButton" />

        </LinearLayout>

    </ScrollView>

</merge>


您的线性布局的样式设置为
LoginFormContainer

<LinearLayout
       style="@style/LoginFormContainer"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:layout_gravity="center_horizontal"
       android:layout_marginTop="20dp"
       android:background="@color/background_login_color"
       android:orientation="vertical" >

在这种样式中,很可能设置了边距。因此,
线性布局中的所有内容都有边距

解决方法是从样式中删除边距。(或从
线性布局中删除样式

注意:这将删除图像下方
editText
等的边距,因为它们也在线性布局中


解决这个问题的方法是,将其余内容包装在自己的
LinearLayout
中,并将边距应用于该
LinearLayout

需要更清晰的内容…我希望蓝色矩形具有白色矩形的宽度,如果蓝色矩形的左右两侧已知,则有白色空格,蓝色矩形的哪个位置那个白色的长方形,,,你们能说清楚一点吗?