Azin Nilchi
Azin Nilchi

Reputation: 899

how to fit border around the ListView when we remove rows?

I have a listView that I put a border in XML around it like below:

android:background="@drawable/border"

and on a button click, it will add a row to my ListView, and inside every row, I have a delete button, so that row can be deleted. but when I delete a row, my border, stays the same, and it doesn't fit my new ListView.

another problem is when I delete all of my rows, the border still stays, how can I remove the border entirely when no rows exist?

thanks in advance

Upvotes: 1

Views: 85

Answers (1)

Navneet Krishna
Navneet Krishna

Reputation: 5017

You can dynamically change height by using

pendingDismiss.view.setLayoutParams(new 
AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, 
AbsListView.LayoutParams.WRAP_CONTENT));

Upvotes: 2

Related Questions