How to resize image view according to screen resol

2019-03-05 05:19发布

问题:

I want to resize image view according to screen resolution and size. How to do it? I searched android development tutorials.. but it is useless.. pls help.. It's for my mini project..

回答1:

You can try to scale the image to X,Y coordinates by setting:

android:scaleType="fitXY"

property.



回答2:

By default, Android maintain multiple folders for the images with different resolutions. Reason behind that is the resolution of the Android Device on which the application is gonna run.

  • hdpi - maintain images for the Android Broad Screen set or Android Phones with the Higher resolution.

  • ldpi - for Lower images quality.

  • mdpi - for medium images support.

  • xhdi - images folder for devices with maximum resolution.

Android OS will select the image itself by checking the compatible device and its resolution. Hope this helps your cause.