简体   繁体   中英

Full screen image size in Android activity

在此处输入图片说明

I'm developing a welcome page for my application that would display a full screen image in an activity, along with two buttons. Very much like the welcome screen of Instagram. I understand that you have images for these modes in Android namely ldpi, mdpi, hdpi, and xhdpi. So my question is, what are the each modes maximum resolution and how do I create images that don't stretch up on multitude of screen resolutions and DPI settings? I've read the official Android guide, supporting multiple screens , though much useful, the article didn't answer my question. Hoping to learn it from here.

Thank you! PS: I won't be supporting landscape orientation for welcome screen of my application.

Well, basically you have different screen densities in android, so you need to add images in different resolutions on each drawable folder, for instance:

  • xlarge screens are at least 960dp x 720dp (drawable-xhdpi)
  • large screens are at least 640dp x 480dp (drawable-hdpi)
  • normal screens are at least 470dp x 320dp (drawable-mdpi)
  • small screens are at least 426dp x 320dp (drawable-ldpi)

Check out this documentation .

In your Activity onCreate()

 requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                                WindowManager.LayoutParams.FLAG_FULLSCREEN);

or in the AndroidManifest.xml Alternatively you can add

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

to AndroidManifest.xml under

or tutorial

For that What ever the images you take that should be vector images so that it is looking good not blurred. And Generate all the images by using 9 patch generate. If you want stretch.

And for the layout write the code by using weight and weight some So that will comes good. For more details please read this. http://www.7solutions.in/2013/10/weightweight-sum-in-android.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM