2012-09-05 102 views
0

我有一個問題。我正在做一個佈局,我希望一個佈局在其他佈局之上。 情況:有一個有Touchlistener的RelativeLayout。在這個佈局的底部,還有其他三個按鈕可以點擊的相對佈局。現在的問題是,當我點擊一個這些按鈕時,第一個佈局的偵聽器被激活並且沒有按鈕工作。如何將佈局放在另一個佈局上

我確實利用了框架佈局,但它沒有工作。使用了.bringToFront方法。但是這也不起作用。

請給我同樣的建議。

我正在上傳我的代碼。

<RelativeLayout 
    android:id="@+id/rlayout" 
    android:layout_width="458dp" 
    android:layout_marginTop="10dp" 
    android:layout_marginLeft="10dp" 
    android:gravity="center" 
    android:layout_height="278dp" 
    android:background="@drawable/anim_layout" > 

    <TextView 
     android:id="@+id/textView" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:gravity="center" 
     android:scaleType="centerInside" 
     android:visibility="visible" /> 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_alignParentTop="true" 
     android:gravity="center" 
     android:scaleType="centerInside" 
     android:visibility="invisible" /> 

</RelativeLayout> 

    <ImageView 
    android:id="@+id/more" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginLeft="4dp" 
    android:layout_gravity="bottom" 
    android:background="@drawable/image_unfocus" /> 

<RelativeLayout 
    android:id="@+id/rlayout_anim_bg" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="bottom" 
    android:layout_marginLeft="4dp" 
    android:background="@drawable/anim_bg" > 

    <ImageButton 
     android:id="@+id/sequence_image" 
     android:layout_width="22dip" 
     android:layout_height="17dip" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" 
     android:layout_marginLeft="22dp" 
     android:layout_marginTop="3dip" 
     android:background="@drawable/unfocus_image" /> 

    <ImageView 
     android:id="@+id/edit_image" 
     android:layout_width="22dip" 
     android:layout_height="17dip" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" 
     android:layout_marginLeft="80dp" 
     android:layout_marginTop="3dp" 
     android:layout_toRightOf="@id/sequence_image" 
     android:background="@drawable/edit_icon" /> 

    <ImageView 
     android:id="@+id/close_image" 
     android:layout_width="22dip" 
     android:layout_height="17dip" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" 
     android:layout_marginLeft="130dp" 
     android:layout_marginTop="3dp" 
     android:layout_toRightOf="@id/edit_image" 
     android:background="@drawable/close_img" /> 
    </RelativeLayout> 

+0

檢查此鏈接http://stackoverflow.com/questions/8367743/how-to-place-a-layout-over-another-and-avoid-the-one-under-being-clicked – Randroid

+0

我做檢查鏈接...並嘗試它,但它不工作。 –

+0

在我的情況下,兩個佈局都有監聽器 –

回答

0

使用佈局氣筒......做一個XML。通過使用充氣器,您可以在前一個版面上膨脹另一個版面。 享受

相關問題