Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android layout Android Studio背景色_Android Layout_Android Studio_Android Relativelayout_Android Background - Fatal编程技术网

Android layout Android Studio背景色

Android layout Android Studio背景色,android-layout,android-studio,android-relativelayout,android-background,Android Layout,Android Studio,Android Relativelayout,Android Background,如何为版面设置自定义颜色?为什么我不能将颜色填充到全屏。边缘仍有空白。我将高度和宽度设置为与父级大小匹配,但仍然相同 我的代码: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_h

如何为版面设置自定义颜色?为什么我不能将颜色填充到全屏。边缘仍有空白。我将高度和宽度设置为与父级大小匹配,但仍然相同

我的代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#9a3939"
    tools:context=".Main_page">

    <android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/cv"
        >

    </android.support.v7.widget.CardView>

    <RelativeLayout
        android:layout_width="100dp"
        android:layout_height="160dp"
        android:padding="2dp"
        android:background="#FFF"
        android:layout_marginTop="90dp"
        android:layout_below="@+id/cv"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:id="@+id/relativeLayout">

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/person_photo"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:background="@drawable/marvel"
            android:layout_above="@+id/person_name"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/person_name"
            android:textSize="15dp"
            android:autoText="false"
            android:text="Life of Pi"
            android:paddingLeft="5dp"
            android:textIsSelectable="true"
            android:textColor="#000000"
            android:layout_above="@+id/person_age"
            android:layout_alignLeft="@+id/person_photo"
            android:layout_alignStart="@+id/person_photo" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/person_age"
            android:text="Yann Martel"
            android:paddingLeft="10dp"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:textSize="10dp" />

    </RelativeLayout>

</RelativeLayout>


我运行此代码,没有白色边框。也许你正在使用这个布局来处理一个恰好在另一个布局中的片段。有什么解决方案吗?你可以帮我。这段代码很好。问题在别处。