android - Maintain aspect ratio of imageview in linearlayout weights? -


I have the following XML code,

with the following design. My problem is that blue area is an image view, I want to keep my aspect ratio to 500 x 500 Because the weight of a width smaller ... like the picture ... tells the 450 ... but then 450x500 instead looks like 450x450 -

  & lt; ?? Xml version = "1.0" encoding = "utf-8"? & Gt; & Lt; scrollview xmlns: android = "http://schemas.android.com/apk/res/android" Android: layout_width = "match_parent" Android: layout_height = "match_parent" & gt; & Lt; LinearLayout Android: layout_width = "match_parent" Android: layout_height = "wrap_content" Android: Layout_marginBottom = "L0dp" Android: weightSum = "10" & gt; & Lt; LinearLayout Android: Layout_width = "Wrap_content" Android: Layout_height = "Wrap_content" android: background = "# 000000" android: gravity = "top" android: layout_weight = "1" android: orientation = "horizontal" & gt; & Lt; imageView android: id = "@ + id / ImageView01" Android: Layout_width = "Match_parent" Android: Layout_height = "Match_parent" Android: adjustViewBounds = "true" android: background = "@ drawable / alert_logo" android: gravity = "top" Android: scaleType = "centerInside" /> & Lt; / LinearLayout & gt; & Lt; LinearLayout Android: Layout_width = "Match_parent" Android: Layout_height = "Match_parent" android: orientation = "vertical" android: background = "# 000000" Android: layout_weight = "9" & gt; & Lt; / LinearLayout & gt; & Lt; / LinearLayout & gt; 

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -