2016-06-09 95 views
0

我有我的屏幕左下角攝像頭拍攝的最後一張圖像的縮略圖。 在其左上角,我有一個X按鈕可刪除相機拍攝的最後一張照片。查看粘貼在FrameLayout外面不會攔截觸摸事件

,當我嘗試按下該按鈕,什麼都不會發生,除非我按它的右下角,一來就是仍然在那裏本意的範圍內是:

這裏是我的佈局

<RelativeLayout 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="1" 
      android:clipChildren="false"> 

      <FrameLayout 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerInParent="true" 
       android:layout_gravity="center" 
       android:clipChildren="false"> 

       <ImageView 
        android:id="@+id/gallery" 
        android:layout_width="48dp" 
        android:layout_height="48dp" 
        android:contentDescription="@string/open_gallery"/> 

       <ImageButton 
        android:id="@+id/deleteLastImage" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="top|left" 
        android:layout_marginLeft="-22dp" 
        android:layout_marginTop="-22dp" 
        android:contentDescription="@string/delete_last_image"/> 
      </FrameLayout> 
     </RelativeLayout> 

下面是它的外觀:

enter image description here

我該如何解決這個問題?

回答

0

所以我工作圍繞它通過不使用切緣陰性,但放置ImageViewFrameLayout像這樣:

<RelativeLayout 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="1" 
      android:clipChildren="false"> 

      <ImageView 
       android:id="@+id/gallery" 
       android:layout_width="48dp" 
       android:layout_height="48dp" 
       android:layout_centerInParent="true" 
       android:layout_gravity="center" 
       android:contentDescription="@string/open_gallery"/> 

      <ImageButton 
       android:id="@+id/deleteLastImage" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="top|left" 
       android:layout_marginLeft="10dp" 
       android:layout_marginTop="10dp" 
       android:contentDescription="@string/delete_last_image" 
       android:visibility="invisible"/> 
     </RelativeLayout>