How to highlight ListView item on touch?

后端 未结 4 1621
野的像风
野的像风 2021-02-02 17:46

I have a simple ListView and I want each of it items to be highlighted on user\'s touch. I thought this should happen by default but it isn\'t. Can you advice?

4条回答
  •  忘了有多久
    2021-02-02 18:35

    I believe this has to do with the "Enabled" attribute of the items in the ListAdapter.

    If your Adapter contains the code:

    @Override
    public boolean areAllItemsEnabled() {
        return true;
    }
    

    Then each item should be clickable (and therefore should highlight on being touched).

    Could you post details (and possibly code) of what kind of Adapter you're using for this list?

提交回复
热议问题