I’m using the following code to change the height of a relative layout that contains a listview. It works fine the first time I call it, but if i call the same code again later to change the height to a different value it does nothing. Why is this and how do I make it work?
LayoutParams params = myrelativelayout.getLayoutParams();
params.height = newHeight;
Try to add myrelativelayout.setLayoutParams(params); every time you change it. This will make sure the view is invalidated each time and that you update the Actual params object for the view.