Issue
I am trying to set an image in my main page to fill up the upper space of the page (as shown below).
But, when I try to test it with different device, the space is not filled properly (as shown in image below). With Pixel3a, there are extra white space at the top and bottom of the image; whereas with Pixel3a XL, there are extra white space at the start and end of the image.
I set the imageview to have the width to match with the parent, and the height to wrap the content, but I don't understand why the "wrap content" is making a space larger than the content itself (which is the image), which led to this extra white space? I guess for the case of the Pixel3a XL, even with setting of the width to match parent, the image still did not match the parent, which led to the extra white space at the start and end of the image. Can someone please point out how can I fix this? I want the image to fill the space properly like in the case of Pixel2. My code shown below:
Solution
Add this attribute line inside your <ImageView>
tag:
android:scaleType="fitXY"
Answered By - Dương Minh
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.