Java – ImageView, why is it different in size?
•
Java
First of all, I know many people have asked the same question, but the question is almost the same, but I have more questions
I have an image of 48px x 48px, so if I set this image in ImageView
layout_width="wrap_content" layout_height="wrap_content"
Then the image looks larger, but if I use the following fixed size, it will become smaller
layout_width="48dp" layout_height="48dp"
I think it is displayed correctly with 48dp (not pixelated?), But if I use wrap_ Content why does it get bigger? If through wrap_ If the image size of content is correct, what does it mean to use DP (if it makes the image smaller)?
Solution
Try this
<ImageView android:id="@+id/seprator2" layout_width="48dp" layout_height="48dp" android:scaleType="fitXY" android:src="@drawable/your_image" />
If it still displays small, then your image must contain alpha around it
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码