android - 怎么在Listview setAdapter的时候,不给Listview焦点?
迷茫
迷茫 2017-04-18 09:15:58
0
2
534

在setadapter的时候,Listview会自己拿到焦点,跳转到最上面。
怎么不让listview拿到焦点呢?

不考虑的方法:
1.把焦点给其他控件
2.把布局写成Listview的header

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(2)
Peter_Zhu

Found a way.
Use setFocuse to determine whether the user clicked it.

刘奇
  1. Call ListView.setAdapter(...) first when the page opens

  2. Refresh data through Adapter.notifyDataChanged()

ListView焦点引起的问题基本无解, 即便处理了, 还是会有不适应的情况. 连ListView滚动时都会获取focus. 所以, 尝试下RecyclerView, 并调用RecyclerView.setFocusable(false).

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!