在listview中动态设置imageview的高度和宽度

在listview中动态设置imageview的高度和宽度,listview,android-imageview,Listview,Android Imageview,我需要能够获得设备屏幕宽度,并将其设置为imageview高度和宽度。imageview位于listview中。我目前在listview使用的baseadapter类中为imageview设置了layoutparams。但这会减慢listview的滚动。当我删除下面的代码时,listview可以正常滚动。有什么帮助吗 RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(width, width); holder.my

我需要能够获得设备屏幕宽度,并将其设置为imageview高度和宽度。imageview位于listview中。我目前在listview使用的baseadapter类中为imageview设置了layoutparams。但这会减慢listview的滚动。当我删除下面的代码时,listview可以正常滚动。有什么帮助吗

RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(width, width);
holder.myimageview.setlayoutParams(rlp);

您是否尝试了这些滚动视图参数

<ListView
    android:id="@+id/postlist"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fastScrollEnabled="true"
    android:persistentDrawingCache="scrolling"
    android:scrollingCache="false"
    >
</ListView>
Android:fastScrollEnabled和Android:scrollingCache改善了我的用户体验

也有看下面的