我想弄清楚如何添加一個OnGestureListener或其他方式來檢測整個屏幕上的觸摸拖動到一個按鈕,或一些其他的小部件,可以添加到視圖。我一直在試圖弄清楚如何做到這一點,我不能。我已經看到併成功地完成了一項活動。任何人都可以爲我解釋這一點,因爲我似乎比我想象的要麻煩得多。謝謝。將OnGestureListener添加到按鈕?
1
A
回答
0
1
我假設你已經通過了http://developer.android.com/resources/articles/gestures.html。訣竅是您可以將GestureOverlayView
作爲另一個View
之上的透明圖層。然後,您可以解析檢測爲屬於底層View
的任何手勢。
在文章中,他們表現出你這樣的佈局:
<android.gesture.GestureOverlayView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gestures"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gestureStrokeType="multiple"
android:eventsInterceptionEnabled="true"
android:orientation="vertical">
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</android.gesture.GestureOverlayView>
檢測到的任何手勢然後可以解釋爲ListView的到來。在你的情況下,用你的Button替換ListView,你應該全部設置好。
相關問題
- 1. 將按鈕添加到BrowseFragment
- 2. 將按鈕添加到ListActivity
- 3. 將按鈕添加到QTableview
- 4. 將按鈕添加到infoWindow
- 5. 將按鈕添加到UIScrollview
- 6. 將按鈕添加到UIDatePicker
- 7. 將按鈕添加到UITableView
- 8. 將UIGesture添加到按鈕
- 9. 將按鈕添加到ListActivity
- 10. 將按鈕添加到jtable
- 11. 將按鈕添加到jtable
- 12. 將按鈕添加到UILabel
- 13. 將按鈕添加到ViewPager
- 14. 將按鈕添加到MKPointAnnotation
- 15. 將CSS類添加到表單按鈕
- 16. 將按鈕動態添加到TableRow
- 17. 將span類添加到動態按鈕
- 18. Grails-將鏈接href添加到按鈕
- 19. WPF:將按鈕列添加到Datagrid
- 20. 將條件添加到按鈕(Swift)
- 21. 如何將按鈕添加到JxTable?
- 22. 將按鈕添加到標題右側
- 23. 如何將文本添加到按鈕?
- 24. 將按鈕添加到android java代碼
- 25. 將自定義按鈕添加到SlickGrid?
- 26. 將按鈕添加到左側UINavigatorcontroller iOS4
- 27. 將「清除」按鈕添加到iPhone UITextField
- 28. 將圖標添加到按鈕
- 29. 將自定義按鈕添加到Galleria
- 30. 將按鈕添加到新元素
我不能在Android 2.2中使用這個,雖然或2.1我可以嗎?這只是在新的3.0的權利? – spierce7 2011-05-13 08:36:31