Java Android ImageView在触摸时不可见

Java Android ImageView在触摸时不可见,java,android,android-layout,Java,Android,Android Layout,我有一个按钮,上面有一个图像视图。ImageView不可单击,因此我仍然可以使用该按钮。奇怪的是,当我触摸按钮时,不可点击的ImageView变为不可见,当我松开按钮时,它再次出现 <RelativeLayout android:id="@+id/buttonMailLayout" android:layout_width="208dp" android:layout_height="160dp" android:layout_centerHorizonta

我有一个按钮,上面有一个图像视图。ImageView不可单击,因此我仍然可以使用该按钮。奇怪的是,当我触摸按钮时,不可点击的ImageView变为不可见,当我松开按钮时,它再次出现

<RelativeLayout
    android:id="@+id/buttonMailLayout"
    android:layout_width="208dp"
    android:layout_height="160dp"
    android:layout_centerHorizontal="true">

    <Button
        android:id="@+id/buttonMail"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/metal"
        android:text="Write Mail"
        android:textSize="32dp"
        android:gravity="bottom|center_horizontal"
        android:paddingBottom="16dp"/>

    <ImageView
        android:id="@+id/imageMail"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/email20"
        android:elevation="2dp"
        android:paddingTop="8dp"
        android:paddingBottom="64dp"
        android:clickable="false"/>

</RelativeLayout>

你知道怎么回事吗?这和海拔高度有关吗?我必须在5.1版的ImageView中添加2dp高程,以使其位于按钮前面。

我认为这是5.0及以上版本中的按钮默认高程行为导致了此问题,请尝试以这种方式将按钮放置在单独的布局中,它应该可以工作:

<RelativeLayout
android:id="@+id/buttonMailLayout"
android:layout_width="208dp"
android:layout_height="160dp"
android:layout_centerHorizontal="true">

<FrameLayout    
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom|center_horizontal"
>
    <Button
        android:id="@+id/buttonMail"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/metal"
        android:text="Write Mail"
        android:textSize="32dp"         
        android:paddingBottom="16dp"/>
</FrameLayout>  
<ImageView
    android:id="@+id/imageMail"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/email20"
    android:elevation="2dp"
    android:paddingTop="8dp"
    android:paddingBottom="64dp"
    android:clickable="false"/>

</RelativeLayout> 


你能在使用
图像视图的地方发布代码吗?也许你应该使用FrameLayout。你到底想做什么?我添加了代码。我根本不与ImageView交互。我只想将该按钮用作普通按钮,但在其前面显示一个可以更改的图像。@waqaslam我将尝试FrameLayout。将报告
<RelativeLayout
android:id="@+id/buttonMailLayout"
android:layout_width="208dp"
android:layout_height="160dp"
android:layout_centerHorizontal="true">

<FrameLayout    
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom|center_horizontal"
>
    <Button
        android:id="@+id/buttonMail"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/metal"
        android:text="Write Mail"
        android:textSize="32dp"         
        android:paddingBottom="16dp"/>
</FrameLayout>  
<ImageView
    android:id="@+id/imageMail"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/email20"
    android:elevation="2dp"
    android:paddingTop="8dp"
    android:paddingBottom="64dp"
    android:clickable="false"/>

</RelativeLayout>