我有一個listFragment
在ViewPager
裏面。問題在於列表OnItemSelected
事件未被解僱。我可以聽到被點擊的項目的反饋聲音,但事件不會被執行。我已經嘗試設置android:descendantFocusability="blocksDescendants"
但它沒有幫助。ListPragment裏面ViewPager onItemSelected沒有射擊
之前,我曾經有一個RecyclerView邏輯(使用Android Studio模板完成),它工作,但我想改變,因爲它看起來很混亂。
我這裏面activity_main.xml
<it.grsrl.rdd.redeye.Tools.CustomViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
這是fragment_list.xml
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/listview_asset_list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
這是簡單item_list.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
<RelativeLayout>
<ImageView />
<TextView/>
<TextView />
<TextView />
</RelativeLayout>
</FrameLayout>
我做了一個試驗:我註冊了我的自定義適配器 一個OnClickListener裏面getView方法和視圖正在接收點擊。那麼,誰在吃我的點擊事件?
任何幫助?
事情很少
onListItemClick
,並試圖覆蓋ViewGroup.onInterceptTouchEvent(MotionEvent EV)?並嘗試使item_list.xml進一步顯示focusable =「false」,clickable =「false」和focusableInTouchMode =「false」。你在哪裏使用了這個android:descendantFocusability =「blocksDescendants」?,它應該用於item_list.xml中的framelayout –我已經按照你所說的設置了一切,但它不會改變任何東西。我不知道如何重寫onInterceptTouchEvent – theBugger