마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

Framelayout으로 view 중첩시 클릭 이벤트

0 추천

메인 액티비티에서 버튼 누르면 "gone" 상태에 있던 레이아웃이 그 위에 나타나되, 뒷 배경에 메인 액티비티가 여전히 보이게 만들었습니다.(새로 뜨는 레이아웃의 height은 200dp정도) 프레임레이아웃을 사용했는데, 위에 있는 레이아웃에서 터치를 해도 밑의 레이아웃이 반응합니다 ㅠㅠㅠㅠㅠㅠㅠㅠ

framelayout에서 두번째 뷰에(나중에 나타나는) clickable 당근 했구요, 아래 뷰의 touch listener에서 false 줘서 다음 뷰로 터치 넘기라고 해서 그것도 해봣는데 다 안되요ㅠㅠㅠㅠㅠ미치겠어요 좀 도와주세요

글자수 제한 때문에 세세한 content들은 생략했습니다. friends_list 누르면 두번째 레이아웃 뜨는 형식입니다.

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    
    <LinearLayout//첫번째 레이아웃!!!
        android:visibility="visible"
        android:id="@+id/mapsLayout"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:orientation="vertical"
        tools:context=".MainActivity"
        >
         <fragment >
        </fragment>
       
        <RelativeLayout
            android:id="@+id/friends_list"
            android:layout_marginRight="5dp"
            android:layout_marginTop="7dp"
            android:layout_marginLeft="5dp"
            android:layout_marginBottom="5dp"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/shape_color">
            <TextView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:text="친구 관리"
                android:textAlignment="center"
                android:textSize="15dp"
                android:gravity="center"/>
            <ImageView/>
        </RelativeLayout>
    </LinearLayout
        >
    <LinearLayout//두번째 레이아웃!!
        android:background="#ffffff"
        android:visibility="gone"
        android:id="@+id/friendsListLayout"
        android:clickable="true"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="300dp">
        <LinearLayout
         />
        <ImageView
         />
        <ListView
          />
        <LinearLayout
              <ImageView/>
            <ImageView/>
        </LinearLayout>
    </LinearLayout>

</FrameLayout>
 ImageView arrowUp=(ImageView)findViewById(R.id.arrowUp);
        arrowUp.setOnClickListener(new View.OnClickListener() {//첫번째 레이아웃 : mapsLayout, 두번째 레이아웃 : friendsListLayout
            @Override
            public void onClick(View v) {
                friendsListLayout.setVisibility(View.VISIBLE);
                friendsListLayout.startAnimation(setAnimUp);
		
                mapsLayout.setClickable(false);
                friendsListLayout.setClickable(true);
                mapsLayout.setOnTouchListener(new View.OnTouchListener() {
                    @Override
                    public boolean onTouch(View v, MotionEvent event) {
                        return false;
                    }
                });
                friendsListLayout.setOnTouchListener(new View.OnTouchListener() {
                    @Override
                    public boolean onTouch(View v, MotionEvent event) {
                        Toast.makeText(getApplicationContext(), "aa", Toast.LENGTH_SHORT).show();
                        return true;
                    }
                });
..생략

            }
        });
         
(240 포인트) 님이 2016년 10월 26일 질문

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...