isudansh
isudansh

Reputation: 369

Change style of first item in listview

I have a list of items in a listView. I would like to highlight the first item of this listview so that the user knows top item is active. How can I go about doing this? Something like the imageenter image description here

Upvotes: 0

Views: 1025

Answers (1)

Waseem Arain
Waseem Arain

Reputation: 1177

Try Some like tha: create custom listview adapter like that and adapter, Custom adapter for a list of items that have multiple child items? then set bg like that:

if (position == 0) {
        // define layout here list 1st item
        view.setBackground(R.drawable.bg);
    } else {
        // others
        view.setBackground(R.drawable.bg);
    }

Upvotes: 2

Related Questions