背景颜色不会出现在某些Android设备上

时间:2014-08-14 14:58:17

标签: java android

在我的应用程序布局中,我已经在背景中设置了自定义颜色,但它们并没有出现在每个Android设备上。在某些设备上,背景显示为白色而不是我设置的颜色。我的应用程序支持android 4到4.4

<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:orientation="horizontal"
    tools:context=".Volume" >

    <TimePicker
        android:id="@+id/ChoosenTime"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true" />

    <View
        android:id="@+id/view1"
        android:layout_width="2dp"
        android:layout_height="match_parent"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@+id/ChoosenTime"
        android:background="#31B6E7" />

    <ScrollView
        android:id="@+id/horizontalScroll"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@+id/view1"
        android:scrollbarAlwaysDrawVerticalTrack="true" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="#FFFFFF"
            android:orientation="vertical" >

            <ToggleButton
                android:id="@+id/sun"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/togglebutton"
                android:onClick="daysOfWeek"
                android:textOff="Sun"
                android:textOn="Sun" />

            <ToggleButton
                android:id="@+id/mon"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/togglebutton"
                android:onClick="daysOfWeek"
                android:textOff="Mon"
                android:textOn="Mon" />

            <ToggleButton
                android:id="@+id/tue"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/togglebutton"
                android:onClick="daysOfWeek"
                android:textOff="Tue"
                android:textOn="Tue" />

            <ToggleButton
                android:id="@+id/wed"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/togglebutton"
                android:onClick="daysOfWeek"
                android:textOff="Wed"
                android:textOn="Wed" />

            <ToggleButton
                android:id="@+id/thu"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/togglebutton"
                android:onClick="daysOfWeek"
                android:textOff="Thu"
                android:textOn="Thu" />

            <ToggleButton
                android:id="@+id/fri"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/togglebutton"
                android:onClick="daysOfWeek"
                android:textOff="Fri"
                android:textOn="Fri" />

            <ToggleButton
                android:id="@+id/sat"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/togglebutton"
                android:onClick="daysOfWeek"
                android:textOff="Sat"
                android:textOn="Sat" />
        </LinearLayout>
    </ScrollView>

    <View
        android:id="@+id/view2"
        android:layout_width="2dp"
        android:layout_height="match_parent"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@+id/horizontalScroll"
        android:background="#31B6E7" />

    <RadioGroup
        android:id="@+id/radioGroup2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_toRightOf="@+id/horizontalScroll"
        android:orientation="horizontal" >

        <RadioButton
            android:id="@+id/sound"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:onClick="onoff"
            android:text="@string/sound" />

        <RadioButton
            android:id="@+id/vibrate"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:onClick="onoff"
            android:text="@string/vibrate" />

        <RadioButton
            android:id="@+id/silent"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:onClick="onoff"
            android:text="@string/silent" />
    </RadioGroup>

    <EditText
        android:id="@+id/EventName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_toLeftOf="@+id/horizontalScroll"
        android:ems="10"
        android:text="@string/event_name" />

    <RadioGroup
        android:id="@+id/radioGroup1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/ChoosenTime"
        android:gravity="center"
        android:orientation="horizontal" >

        <RadioButton
            android:id="@+id/on"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:onClick="onoff"
            android:text="@string/turn_on" />

        <RadioButton
            android:id="@+id/off"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:onClick="onoff"
            android:text="@string/turn_off" />
    </RadioGroup>

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/radioGroup2"
        android:layout_toRightOf="@+id/view2"
        android:orientation="horizontal" >

        <CheckBox
            android:id="@+id/wifi"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:onClick="checkBoxClicked"
            android:text="@string/wifi" />

        <CheckBox
            android:id="@+id/bluetooth"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:onClick="checkBoxClicked"
            android:text="@string/bluetooth" />

    </LinearLayout>

    <CheckBox
        android:id="@+id/airplane"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/linearLayout1"
        android:layout_toRightOf="@+id/horizontalScroll"
        android:onClick="checkBoxClicked"
        android:text="@string/airplane_mode" />

</RelativeLayout>

0 个答案:

没有答案