我有一个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