파일을 선택할 대화 상자가 있습니다. 이 대화 상자에는 디렉토리 및 파일을 표시하는 listview가 있으며 탐색 목적으로 onItemClickListener가 있습니다.전체 대화 상자의 Android onTouchListener
플링 이벤트에 어떻게 대응하여 디렉토리 구조에 올라갈 수 있습니까?
final GestureDetector detector = new GestureDetector(new MyGestureDetector(tvCurrentPath));
dialog.findViewById(R.id.rlFilelist).setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View view, MotionEvent e) {
detector.onTouchEvent(e);
return false;
}
});
이벤트는 onTouch()에 등록 얻을하지만 onFling() 메소드가 MyGestureDetector에 호출되지 않습니다 : 파견 내 GestureListener에 터치 이벤트에 나는 루트 RelativeLayout의 상 OnTouchListener를 설정했습니다. 그러나 OnTouchListener를 listview에 첨부하면 예상대로 작동합니다. 이 방법의 문제점은 목록 뷰가 항상 데이터로 가득 채워져 있지 않으며 비어 있거나 항목 아래를 클릭하면 onTouch() 이벤트가 트리거되지 않는다는 것입니다.
대화 레이아웃 : 완전히 작성되지 lisview와 대화에 대한
이<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rlFilelist"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:focusable="true" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/llButtons" >
<TextView
android:id="@+id/tvCurrentPath"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip" >
</TextView>
<ListView
android:id="@+id/lvFileListing"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@id/llButtons"
android:layout_below="@id/tvCurrentPath" >
</ListView>
</RelativeLayout>
<RelativeLayout
android:id="@+id/llButtons"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="5dip"
android:layout_marginTop="5dip" >
<Button
android:id="@+id/btAddDirectory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginRight="10px"
android:text="@string/host_tv_dg_add_directory" />
<Button
android:id="@+id/btUp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10px"
android:layout_toRightOf="@id/btAddDirectory"
android:text="@string/host_tv_dg_navigate_up" />
<Button
android:id="@+id/btClose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/btUp"
android:text="@string/_tv_close" />
</RelativeLayout>
</RelativeLayout>
스크린 샷 : http://imageshack.us/photo/my-images/802/dialog.png/
은 어떻게 onFling을() 이벤트가 전체 대화 또는 "전체"목록보기에서 트리거 할 수 있습니다 항목으로 완전히 채워지지 않은 경우에도?
감사합니다.