Android 安卓按钮放置在背景上时会失去颜色

Android 安卓按钮放置在背景上时会失去颜色,android,android-layout,Android,Android Layout,我有一个自定义按钮(相对布局),如下所示: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="50dp" android:layout_width="130dp" android:background="#ffffff"

我有一个自定义按钮(相对布局),如下所示:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="50dp"
    android:layout_width="130dp"
    android:background="#ffffff"
    android:paddingRight="10dp"
    android:paddingLeft="5dp"
    android:paddingTop="5dp"
    android:paddingBottom="5dp">

    <ImageView
        android:id="@+id/test_button_alege_image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_action_accept"
        android:layout_alignParentTop="true"
        android:paddingTop="5dp" />

    <TextView
        android:id="@+id/btn_rel_text1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="18sp"
        android:text="Title"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@+id/test_button_alege_image" />

    <TextView
        android:id="@+id/btn_rel_text2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="buton"
        android:layout_below="@+id/btn_rel_text1"
        android:layout_toRightOf="@+id/test_button_alege_image" />

</RelativeLayout>
<RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="110dp"
        android:id="@+id/relativeLayout"
        android:background="@drawable/grad_blue">

        <include android:id="@+id/btn_backmsg"
            layout="@layout/test_buton_white"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" />
...

我将其放置在具有颜色背景的相对布局上,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="50dp"
    android:layout_width="130dp"
    android:background="#ffffff"
    android:paddingRight="10dp"
    android:paddingLeft="5dp"
    android:paddingTop="5dp"
    android:paddingBottom="5dp">

    <ImageView
        android:id="@+id/test_button_alege_image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_action_accept"
        android:layout_alignParentTop="true"
        android:paddingTop="5dp" />

    <TextView
        android:id="@+id/btn_rel_text1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="18sp"
        android:text="Title"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@+id/test_button_alege_image" />

    <TextView
        android:id="@+id/btn_rel_text2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="buton"
        android:layout_below="@+id/btn_rel_text1"
        android:layout_toRightOf="@+id/test_button_alege_image" />

</RelativeLayout>
<RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="110dp"
        android:id="@+id/relativeLayout"
        android:background="@drawable/grad_blue">

        <include android:id="@+id/btn_backmsg"
            layout="@layout/test_buton_white"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" />
...

...
@drawable/grad_蓝是一种深蓝色渐变色。所以它应该是一个暗蓝色渐变背景,上面有一个白色按钮

但当我运行应用程序并进入活动时,按钮没有我设置的白色布局。它的颜色比所处布局的背景颜色深一点。 我怎样才能避免这种情况? 我的意思是,我怎样才能使按钮保持白色


谢谢大家

来吧,伙计们,应该很简单。彩色背景上的白色按钮…?可能是
@layout/test\u buton\u white
@layout/test\u buton\u white
…尝试将固定宽度和高度设置为(如130x50dp)三角形。。。认真地这只是我给布局起的名字(它不必是英文的,它只需要在活动的布局中与声明的相同)Fllo,即使我不明白大小如何帮助解决颜色设置问题,我尝试了你的想法,但仍然一无所获。你可以试试代码,自己看看吗?非常感谢。