pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

    <bdo id='tAALr'></bdo><ul id='tAALr'></ul>

<small id='tAALr'></small><noframes id='tAALr'>

    <tfoot id='tAALr'></tfoot>
  1. <legend id='tAALr'><style id='tAALr'><dir id='tAALr'><q id='tAALr'></q></dir></style></legend>

      <i id='tAALr'><tr id='tAALr'><dt id='tAALr'><q id='tAALr'><span id='tAALr'><b id='tAALr'><form id='tAALr'><ins id='tAALr'></ins><ul id='tAALr'></ul><sub id='tAALr'></sub></form><legend id='tAALr'></legend><bdo id='tAALr'><pre id='tAALr'><center id='tAALr'></center></pre></bdo></b><th id='tAALr'></th></span></q></dt></tr></i><div class="kkcssuc" id='tAALr'><tfoot id='tAALr'></tfoot><dl id='tAALr'><fieldset id='tAALr'></fieldset></dl></div>

    1. 整個對話框的Android onTouchListener

      Android onTouchListener for entire dialog(整個對話框的Android onTouchListener)

            <tbody id='zcoNv'></tbody>
          • <bdo id='zcoNv'></bdo><ul id='zcoNv'></ul>
                <tfoot id='zcoNv'></tfoot>
                <i id='zcoNv'><tr id='zcoNv'><dt id='zcoNv'><q id='zcoNv'><span id='zcoNv'><b id='zcoNv'><form id='zcoNv'><ins id='zcoNv'></ins><ul id='zcoNv'></ul><sub id='zcoNv'></sub></form><legend id='zcoNv'></legend><bdo id='zcoNv'><pre id='zcoNv'><center id='zcoNv'></center></pre></bdo></b><th id='zcoNv'></th></span></q></dt></tr></i><div class="22ggi20" id='zcoNv'><tfoot id='zcoNv'></tfoot><dl id='zcoNv'><fieldset id='zcoNv'></fieldset></dl></div>

                <legend id='zcoNv'><style id='zcoNv'><dir id='zcoNv'><q id='zcoNv'></q></dir></style></legend>

                <small id='zcoNv'></small><noframes id='zcoNv'>

                本文介紹了整個對話框的Android onTouchListener的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我有一個對話框可以從中選擇文件.此對話框包含一個用于顯示目錄和文件的列表視圖,并具有一個用于導航目的的 onItemClickListener.

                I have a dialog to choose files from. This dialog contains a listview to show directories and files and has an onItemClickListener for navigation purposes.

                我如何對在目錄結構中上升的投擲事件做出反應?我嘗試在根 RelativeLayout 上設置 OnTouchListener 以將觸摸事件發送到我的 GestureListener:

                How can I react to fling events to go up in the directory structure? I tried setting an OnTouchListener on the root RelativeLayout to dispatches touch events to my GestureListener:

                    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() 中注冊,但從未在 MyGestureDetector 中調用 onFling() 方法.但是,如果我將 OnTouchListener 附加到列表視圖,它會按預期工作.這種方法的問題是列表視圖并不總是大量填充數據,當它為空或單擊下面的項目時,不會觸發任何 onTouch() 事件.

                The events get registered in onTouch(), but the onFling() method is never called in the MyGestureDetector. If, however, I attach the OnTouchListener to the listview, it works as expected. The problem with this approach is that the listview is not always filled extensively with data and when it is empty or when clicking below items, no onTouch() events are triggered.

                對話框布局:

                    <?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>
                

                未完全填充 lisview 的對話框的屏幕截圖:http://imageshack.us/photo/my-images/802/dialog.png/

                Screenshot for dialog with not completely filled lisview: http://imageshack.us/photo/my-images/802/dialog.png/

                如何使 onFling() 事件在整個對話框或整個"列表視圖上觸發,即使它沒有完全填充項目?

                How can I make the onFling() events trigger on the whole dialog or on the "whole" listview even when it's not completely filled with items?

                謝謝!

                推薦答案

                您應該創建一個擴展對話框類的類,然后您可以創建一個手勢檢測器并附加到該類的 ontouchevent.這是一個代碼示例:

                You should create a class which extends the dialog class and then you can create a gesture detector and attach to the ontouchevent of the class. Here is a code example:

                public class GestureDialog extends Dialog {
                    public GestureDialog (Context context, int theme) {
                        super(context, theme);
                
                        gestDetec = new MyGestureDetector();    //inital setup
                        gestureDetector = new GestureDetector(gestDetec);   
                        gestureListener = new View.OnTouchListener() {
                            public boolean onTouch(View v, MotionEvent event) {
                                if (gestureDetector.onTouchEvent(event)) {
                                    return true;
                                }
                                return false;
                            }
                        };
                    }
                    @Override
                    public boolean onTouchEvent(MotionEvent event) {
                        if (gestureDetector.onTouchEvent(event))
                            return true;
                        else
                            return false;
                    }
                class MyGestureDetector extends SimpleOnGestureListener {
                    @Override
                    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
                
                        System.out.println( "Help im being touched!" );
                        return false;
                    }
                }
                
                }
                

                這篇關于整個對話框的Android onTouchListener的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                Get user#39;s current location using GPS(使用 GPS 獲取用戶的當前位置)
                IllegalArgumentException thrown by requestLocationUpdate()(requestLocationUpdate() 拋出的 IllegalArgumentException)
                How reliable is LocationManager#39;s getLastKnownLocation and how often is it updated?(LocationManager 的 getLastKnownLocation 有多可靠,多久更新一次?)
                How to detect Location Provider ? GPS or Network Provider(如何檢測位置提供者?GPS 或網絡提供商)
                Get current location during app launch(在應用啟動期間獲取當前位置)
                locationManager.getLastKnownLocation() return null(locationManager.getLastKnownLocation() 返回 null)

              1. <i id='z3Dpp'><tr id='z3Dpp'><dt id='z3Dpp'><q id='z3Dpp'><span id='z3Dpp'><b id='z3Dpp'><form id='z3Dpp'><ins id='z3Dpp'></ins><ul id='z3Dpp'></ul><sub id='z3Dpp'></sub></form><legend id='z3Dpp'></legend><bdo id='z3Dpp'><pre id='z3Dpp'><center id='z3Dpp'></center></pre></bdo></b><th id='z3Dpp'></th></span></q></dt></tr></i><div class="msaciks" id='z3Dpp'><tfoot id='z3Dpp'></tfoot><dl id='z3Dpp'><fieldset id='z3Dpp'></fieldset></dl></div>
                • <bdo id='z3Dpp'></bdo><ul id='z3Dpp'></ul>

                      <legend id='z3Dpp'><style id='z3Dpp'><dir id='z3Dpp'><q id='z3Dpp'></q></dir></style></legend>

                        <tbody id='z3Dpp'></tbody>
                      <tfoot id='z3Dpp'></tfoot>

                          <small id='z3Dpp'></small><noframes id='z3Dpp'>

                        • 主站蜘蛛池模板: 德国进口电锅炉_商用电热水器_壁挂炉_电采暖器_电热锅炉[德国宝] | 自动部分收集器,进口无油隔膜真空泵,SPME固相微萃取头-上海楚定分析仪器有限公司 | 广州展览制作工厂—[优简]直营展台制作工厂_展会搭建资质齐全 | 「安徽双凯」自动售货机-无人售货机-成人用品-自动饮料食品零食售货机 | 建筑工程资质合作-工程资质加盟分公司-建筑资质加盟 | 防火阀、排烟防火阀、电动防火阀产品生产销售商-德州凯亿空调设备有限公司 | 电动垃圾车,垃圾清运车-江苏速利达机车有限公司 | 北京网络营销推广_百度SEO搜索引擎优化公司_网站排名优化_谷歌SEO - 北京卓立海创信息技术有限公司 | 高光谱相机-近红外高光谱相机厂家-高光谱成像仪-SINESPEC 赛斯拜克 | 磁棒电感生产厂家-电感器厂家-电感定制-贴片功率电感供应商-棒形电感生产厂家-苏州谷景电子有限公司 | 贝壳粉涂料-内墙腻子-外墙腻子-山东巨野七彩贝壳漆业中心 | 武汉高温老化房,恒温恒湿试验箱,冷热冲击试验箱-武汉安德信检测设备有限公司 | 吨袋包装机|吨包秤|吨包机|集装袋包装机-烟台华恩科技 | 橡胶接头_橡胶软接头_套管伸缩器_管道伸缩器厂家-巩义市远大供水材料有限公司 | 氟氨基酮、氯硝柳胺、2-氟苯甲酸、异香兰素-新晨化工 | 厌氧反应器,IC厌氧反应器,厌氧三相分离器-山东创博环保科技有限公司 | 锂电混合机-新能源混合机-正极材料混料机-高镍,三元材料混料机-负极,包覆混合机-贝尔专业混合混料搅拌机械系统设备厂家 | 意大利Frascold/富士豪压缩机_富士豪半封闭压缩机_富士豪活塞压缩机_富士豪螺杆压缩机 | 登车桥动力单元-非标液压泵站-非标液压系统-深圳市三好科技有限公司 | 安徽净化板_合肥岩棉板厂家_玻镁板厂家_安徽科艺美洁净科技有限公司 | 协议书_协议合同格式模板范本大全 | 雨燕360体育免费直播_雨燕360免费NBA直播_NBA篮球高清直播无插件-雨燕360体育直播 | 山东聚盛新型材料有限公司-纳米防腐隔热彩铝板和纳米防腐隔热板以及钛锡板、PVDF氟膜板供应商 | 合肥废气治理设备_安徽除尘设备_工业废气处理设备厂家-盈凯环保 合肥防火门窗/隔断_合肥防火卷帘门厂家_安徽耐火窗_良万消防设备有限公司 | 成人纸尿裤,成人尿不湿,成人护理垫-山东康舜日用品有限公司 | 动物解剖台-成蚊接触筒-标本工具箱-负压实验台-北京哲成科技有限公司 | 无痕胶_可移胶_无痕双面胶带_可移无痕胶厂家-东莞凯峰 | 北京三友信电子科技有限公司-ETC高速自动栏杆机|ETC机柜|激光车辆轮廓测量仪|嵌入式车道控制器 | 奇酷教育-Python培训|UI培训|WEB大前端培训|Unity3D培训|HTML5培训|人工智能培训|JAVA开发的教育品牌 | 东莞市海宝机械有限公司-不锈钢分选机-硅胶橡胶-生活垃圾-涡电流-静电-金属-矿石分选机 | 广州展览设计公司_展台设计搭建_展位设计装修公司-众派展览装饰 广州展览制作工厂—[优简]直营展台制作工厂_展会搭建资质齐全 | 【中联邦】增稠剂_增稠粉_水性增稠剂_涂料增稠剂_工业增稠剂生产厂家 | 优宝-汽车润滑脂-轴承润滑脂-高温齿轮润滑油脂厂家 | 道康宁消泡剂-瓦克-大川进口消泡剂供应商 | jrs高清nba(无插件)直播-jrs直播低调看直播-jrs直播nba-jrs直播 上海地磅秤|电子地上衡|防爆地磅_上海地磅秤厂家–越衡称重 | 5nd音乐网|最新流行歌曲|MP3歌曲免费下载|好听的歌|音乐下载 免费听mp3音乐 | 喷砂机厂家_自动喷砂机生产_新瑞自动化喷砂除锈设备 | 刺绳_刀片刺网_刺丝滚笼_不锈钢刺绳生产厂家_安平县浩荣金属丝网制品有限公司-安平县浩荣金属丝网制品有限公司 | 管理会计网-PCMA初级管理会计,中级管理会计考试网站 | 蜂窝块状沸石分子筛-吸附脱硫分子筛-萍乡市捷龙环保科技有限公司 | 净化工程_无尘车间_无尘车间装修-广州科凌净化工程有限公司 |