When practicing Android, want to put a picture in LinearLayout, make its picture pinned, the expected effect is this:
But after the XML code ImageView is written like this,
<imageview android:layout_width= "match_parent" android:layout_height= "wrap_content" android:src = "@drawable/moegirl_help" />
And the effect is like this.
Try to thank the method, including change to relativelayout layout, adjust layout_grativity and so on, until you think of ScaleType this method:
<imageview android:layout_width= "match_parent" android:layout_height= "wrap_content" android:src = "@drawable/moegirl_help" android:scaletype= "Fitstart" />
ScaleType property value is Fitstart, the picture is top-aligned;
ScaleType property value is Fitend, the picture is bottom-aligned;
ScaleType property value is Fitxy, the picture is stretched full screen.
Android LinearLayout ImageView Top Placement