Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/335.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
Java 内容限制上的背景色_Java_Android - Fatal编程技术网

Java 内容限制上的背景色

Java 内容限制上的背景色,java,android,Java,Android,我有一个活动,它的布局覆盖了大约半个屏幕 这是我的布局: <?xml version="1.0" encoding="utf-8"?> 如何仅为屏幕中包含内容的空间设置背景色 例如,如果我的屏幕有70%的内容,我只希望屏幕的这一部分有背景色 谢谢。 <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content"

我有一个活动,它的布局覆盖了大约半个屏幕

这是我的布局:

<?xml version="1.0" encoding="utf-8"?>


如何仅为屏幕中包含内容的空间设置背景色

例如,如果我的屏幕有70%的内容,我只希望屏幕的这一部分有背景色

谢谢。


 <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="#ffffff"
        android:orientation="vertical" >
<ImageView
        android:id="@+id/imageView1"
        android:layout_width="66dp"
        android:layout_height="64dp"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="10dp" />

    <TextView
            android:id="@+id/greetingTextView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Sir,"
            android:layout_toRightOf="@+id/imageView1"
            android:layout_marginLeft="5dp"
            android:layout_marginTop="10dp"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/dailyStatusTextView"
            android:layout_width="wrap_content"
            android:layout_toRightOf="@+id/imageView1"
            android:layout_below="@+id/greetingTextView"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_marginTop="3dp"
            android:text="Dont forget!" />

<TextView
    android:id="@+id/Reminder_title_TV"
    android:layout_width="fill_parent"
    android:text="Tiltle"
    android:textSize="25sp"
    android:layout_height="wrap_content"
    android:layout_below="@+id/imageView1"
    android:layout_marginLeft="15dp"

    android:layout_marginTop="10dp"/>
<!--         android:textColor="#ff33b5e5" -->

<TextView
    android:id="@+id/Reminder_text_TV"
    android:layout_width="fill_parent"
    android:text="Text"
    android:textSize="15sp"
    android:layout_height="wrap_content"
    android:layout_below="@+id/Reminder_title_TV"
    android:layout_marginLeft="15dp"

    android:layout_marginTop="10dp"/>
<!--         android:textColor="#ff33b5e5" -->


</LinearLayout>

<!-- End your linear layout here if this is 70 percent -->


 <Button
    android:id="@+id/not_now_BT"
    android:layout_width="100dp"
    android:layout_height="wrap_content"

    android:text=" Not Now "
    android:layout_marginTop="15dp"
    android:layout_marginLeft="60dp"
    android:paddingBottom="10dp"
    android:layout_below="@+id/Reminder_text_TV"
    />
 <Button
    android:id="@+id/OK_BT"
    android:layout_width="100dp"
    android:layout_height="wrap_content"
    android:text=" OK "
    android:layout_marginTop="15dp"
    android:layout_marginLeft="5dp"
    android:paddingBottom="10dp"
    android:layout_toRightOf="@+id/not_now_BT"
    android:layout_below="@+id/Reminder_text_TV"
    />
 <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="#ffffff"
        android:orientation="vertical" >
<ImageView
        android:id="@+id/imageView1"
        android:layout_width="66dp"
        android:layout_height="64dp"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="10dp" />

    <TextView
            android:id="@+id/greetingTextView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Sir,"
            android:layout_toRightOf="@+id/imageView1"
            android:layout_marginLeft="5dp"
            android:layout_marginTop="10dp"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/dailyStatusTextView"
            android:layout_width="wrap_content"
            android:layout_toRightOf="@+id/imageView1"
            android:layout_below="@+id/greetingTextView"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_marginTop="3dp"
            android:text="Dont forget!" />

<TextView
    android:id="@+id/Reminder_title_TV"
    android:layout_width="fill_parent"
    android:text="Tiltle"
    android:textSize="25sp"
    android:layout_height="wrap_content"
    android:layout_below="@+id/imageView1"
    android:layout_marginLeft="15dp"

    android:layout_marginTop="10dp"/>
<!--         android:textColor="#ff33b5e5" -->

<TextView
    android:id="@+id/Reminder_text_TV"
    android:layout_width="fill_parent"
    android:text="Text"
    android:textSize="15sp"
    android:layout_height="wrap_content"
    android:layout_below="@+id/Reminder_title_TV"
    android:layout_marginLeft="15dp"

    android:layout_marginTop="10dp"/>
<!--         android:textColor="#ff33b5e5" -->


</LinearLayout>

<!-- End your linear layout here if this is 70 percent -->


 <Button
    android:id="@+id/not_now_BT"
    android:layout_width="100dp"
    android:layout_height="wrap_content"

    android:text=" Not Now "
    android:layout_marginTop="15dp"
    android:layout_marginLeft="60dp"
    android:paddingBottom="10dp"
    android:layout_below="@+id/Reminder_text_TV"
    />
 <Button
    android:id="@+id/OK_BT"
    android:layout_width="100dp"
    android:layout_height="wrap_content"
    android:text=" OK "
    android:layout_marginTop="15dp"
    android:layout_marginLeft="5dp"
    android:paddingBottom="10dp"
    android:layout_toRightOf="@+id/not_now_BT"
    android:layout_below="@+id/Reminder_text_TV"
    />