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

각 탭 화면마다 터치 이벤트를 어떻게 적용할까요?

0 추천

1        2   

제가 탭마다 터치 이벤트를 구현하고 싶습니다. 저 1번 그림의 리스트 메뉴 외에 다른 곳을 터치하면 

visibility를 바꿔가면서 2번 그림처럼 접히는 기능을 구현 중에 있습니다. 그런데 

주보탭에만 public boolean onTouchEvent(MotionEvent event) 함수가 적용이 되고 

다른 탭들에서는 터치 하면 메뉴가 안접힙니다. 

 

제가 레이아웃을 구성한 방식은 

탭 클릭시 Activity를 띄우는 것이 아니라

각 TabRow에서 content만 바꾸는 형식으로 만들었거든요? 어떤 식으로 처리해야 onTouchEvent를 각 탭마다 적용시킬수 있을까요?..

 

고수님들 초보개발자좀 도와주십시요.....

 

xml 소스 첨부하겠습니다.  부탁드립니다..


    
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"  
        android:id="@+id/tabhost"  
        android:layout_width="fill_parent"  
        android:layout_height="fill_parent" 
        
        >  
        <LinearLayout  
            android:layout_width="match_parent"  
            android:layout_height="match_parent"  
            android:orientation="vertical" 
            android:background="@drawable/cafe"
            >  
            <TabWidget  
                android:id="@android:id/tabs"  
                android:layout_width="fill_parent"  
                android:layout_height="wrap_content" 
                android:tabStripEnabled="false"
                >  
            </TabWidget>  
  		  
 	<FrameLayout  
                android:id="@android:id/tabcontent"  
                android:layout_width="fill_parent"  
                android:layout_height="fill_parent"
                 >
    	
                <ScrollView  
                    android:id="@+id/tab1"  
                    android:layout_width="fill_parent"  
                    android:layout_height="wrap_content" >  
  					
		    <TableRow  
	               android:id="@+id/tableRow1"  
		       android:layout_width="match_parent"  
		       android:layout_height="match_parent">  
						
		        <ListView
				android:id="@+id/listView0"
				 android:layout_width="140dp"
				 android:layout_height="wrap_content"
				 android:cacheColorHint="#00000000"
				 android:background="#1087CEFA"
				 android:visibility="gone"
			 />
		                       
		          <Button 
		               android:id="@+id/btn_view_list0"
		               android:layout_width="wrap_content"
		               android:layout_height="wrap_content"
		               android:background="#00000000"
		               android:gravity="top|left"
		               android:drawableTop="@drawable/btn_view_list"
		               android:visibility="visible"
		                />		
		             </TableRow>
		                  
  					
               
                </ScrollView>
                
                ...... 이런식으로 TableRow가 3개 더있음 .. 생략

 

진동이 1 (120 포인트) 님이 2014년 8월 15일 질문

답변 달기

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