0

How to develop app for small screen size but high in density devices? In my case , I have asus zenfone2 which has 5.5 screen with 414 ppi density means it is xxhdpi device I think but another phone has 5 inch screen with 441ppi density so is it steel xxhdpi or normal-xxhdpi? I don't know the difference between xxhdpi , normal-xxhdpi,large-xxhdpi. how to develop app for such different screen size?

sanket
  • 149
  • 1
  • 2
  • 11
  • Since when, 5" is considered a "small-screen"?? – Phantômaxx Feb 20 '17 at 13:36
  • not like that but compare to 5.5 inch ; its small screen than 5.5 – sanket Feb 20 '17 at 13:36
  • Still it's xxhdpi. https://developer.android.com/reference/android/util/DisplayMetrics.html. – Phantômaxx Feb 20 '17 at 13:38
  • @Rotwang then both are xxhdpi devices but results of both are different because in my case with 5.5inch screen size texts are perfect aligned but on 5inch screen they overlap – sanket Feb 20 '17 at 13:40
  • Screen sizes and screen densities are very different concepts. Which is why you should use dps and sps instead of pixels. – Phantômaxx Feb 20 '17 at 13:42
  • yes, but I don't know why this happening ; also I have heard of these concepts like normal-xxhdpi and xxhdpi . I don't know much about them . – sanket Feb 20 '17 at 13:44
  • That's for dealing with tablets. Which can have different combinations of screen sizes and densities than normally found od phones. – Phantômaxx Feb 20 '17 at 13:47

2 Answers2

0

When dealing with specifics screens size i recommend using as much as you can the attribute layout_weight in your views and view group. It will compute the size of your view depending on your screen size. But you have to know that if you have deep view's hierarchy the time of processing vue will raise exponentially.

Cedric Franck
  • 526
  • 4
  • 9
0

First 5.5 is not considered a small screen. Then lets make the difference between size and density

Screen size is the physical size of the screen (whether in inch or cm. Screen density is the ratio of how many pixels / area of screen size (that's why the unit is dpi, or dots per inch)

I can give you some directions for having same results on different screen sizes.

First for the outer layouts.

  • Wrap root layouts Scroll view or Nested scroll view with Coordinator layout. It will allow scrolling to the bottom of the page when a screen is not enough.
  • Use Collapsing for the Coordinator layout with the scroll views or nested scroll views. It will collapse the parts of the UI that are not needed when the user scrolls.
  • FABs have great animations for hiding and showing when not needed and they work like charm with the coordinator layout. You can customize their behavior a lot.
  • You can also use PercentageRelativeLayout and the normal RelativeLayout or LinearLayout with the weight property instead of absolute layouts. It is easy to create responsive design with them

For the inner views

  • Use wrap_content, match_parent, or dp units when specifying dimensions in an XML layout file. Except for defining text sizes: sp (scaling depends on user setting).

  • Do not use hard-coded pixel values in your application code.

  • Supply alternative bitmap drawables for different screen densities.

  • Provide different sizes for icons

You can read more about the collapsing views here. And more about screen sizes here.

Community
  • 1
  • 1
loshkin
  • 1,600
  • 2
  • 21
  • 38
  • I am not saying 5.5 inch or 5inch screens are small I am saying that as compared to 5.5 inch screen 5 inch screen is small and that phone has high density 441ppi and my 5.5 inch phone has 414 ppi – sanket Feb 21 '17 at 06:06