Markonioninioni
Markonioninioni

Reputation: 412

list View click to set button to be visible

I got these list view. I want to set this deleteRowButton to be visible when I tap on list row (I want that button to show up in the row that was tapped). So I gave that button android:visibility="invisible" attribute and added these two lines to onItemClick method:`

@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {

        deleteRowButton = (TextView) findViewById(R.id.listRowDeleteButton);
        deleteRowButton.setVisibility(View.VISIBLE); }

But when I tap on the some list row, that deleteRowButton shows up in row which is at the top of the list (not the one I tapped). How can I accomplish this?

Upvotes: 0

Views: 603

Answers (1)

Simas
Simas

Reputation: 44118

Try finding the TextView in the item you clicked:

deleteRowButton = (TextView) arg1.findViewById(R.id.listRowDeleteButton);

Upvotes: 1

Related Questions