2012-09-05 4 views
0

질문이 있습니다. 나는 하나의 레이아웃을 다른 레이아웃 위에 배치하고자하는 레이아웃에서 작업하고 있습니다. 상황 : TouchListener가있는 RelativeLayout이 하나 있습니다. 이 레이아웃의 맨 아래에는 클릭 가능한 3 개의 버튼이있는 상대적 레이아웃이 있습니다. 이제 문제는 하나의 버튼을 클릭하면 첫 번째 레이아웃의 수신기가 활성화되고 아무 것도 작동하지 않는다는 것입니다.한 레이아웃을 다른 레이아웃에 배치하는 방법

프레임 레이아웃을 사용했지만 작동하지 않았습니다. .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을합니다. 인플레이터를 사용하면 이전 레이아웃보다 다른 레이아웃을 부 풀릴 수 있습니다. enjoy

관련 문제