Android根据宽度设置图像视图高度

Chr*_*rys 5 android imageview android-activity

如何设置ImageView的高度以保持其纵横比?在XML中,我将fill_parent设置为布局宽度,将wrap_content设置为布局高度,但是我得到了: 屏幕快照http://kepfeltoltes.hu/141206/Screenshot_2014-12-06-19-09-30_1__www.kepfeltoltes.hu_.png

Dal*_*kar 6

您可以android:adjustViewBounds="true"在XML或setAdjustViewBounds(true)ImageView上的代码中使用