如何在 Android 中动态更改 ListView 高度? [英] How to change ListView height dynamically in Android?
本文介绍了如何在 Android 中动态更改 ListView 高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在我的应用中动态更改 ListView 的高度.
I need to change the height of a ListView dynamically in my app.
有没有办法做到这一点?
Is there any way to do that?
推荐答案
动态改变高度和宽度,试试这个
for change height and width dynamically so, try this
RelativeLayout.LayoutParams mParam = new RelativeLayout.LayoutParams((int)(width),(int)(height);
listView.setLayoutParams(mParam);
您也可以使用 LayoutParams.FILL_PARENT 或 LayoutParams.WRAP_CONTENT 代替 height &宽度
you can also use LayoutParams.FILL_PARENT or LayoutParams.WRAP_CONTENT instead of height & width
这篇关于如何在 Android 中动态更改 ListView 高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文