Can I make a ListView item not selectable?

前端 未结 3 1207
刺人心
刺人心 2021-02-05 01:10

I am implementing an endless ListView (like in the Twitter app). I want to make the last item not selecteble. So that if the penultimate item is selected and I scroll down with

相关标签:
3条回答
  • 2021-02-05 01:33

    if you're using custom array adapter just override this method.

    @Override
    public boolean isEnabled(int position) {
        return false;
    }
    
    0 讨论(0)
  • 2021-02-05 01:36

    If you want to get the same effect without having to have a custom adapter, you make the OnClickListener ignore that item when tapped and then set a solid background color for the item's view, so it doesn't highlight when tapped.

    0 讨论(0)
  • 2021-02-05 01:37

    It's pretty easy, in your adapter you can override the method isEnabled(int position) and return false for this item.

    0 讨论(0)
提交回复
热议问题