Jitesh
Jitesh

Reputation: 269

Display listview item containing a button in it as a overlay on top of other listview item's on click

Display listview item containing a button in it as a overlay on top of other listview item's on click in android

Upvotes: 2

Views: 1042

Answers (1)

Cameron
Cameron

Reputation: 3108

Based on your question and comment, I think this is what you need to do:

Set the onClick for the items in the ListView

listView.setOnItemClickListener(new OnItemClickListener () {
    public void onItemClick(AdapterView<?> _av, View _v, int _index, long arg3) {
        //Sliding drawer code
    }
});

In your getView code you will set an OnClickListener to the button

Button button = (Button) convertView.findViewById(R.id.button);
button.setOnClickListener(new OnClickListener() {
    public void onClick(View arg0) {
        //Code to determine what button does
    }
});

Since each button has a different action, you'll probably want a function, switch statement, or something similar to determine what action to set.

Upvotes: 2

Related Questions