Tecnologia da Net
Tecnologia da Net

Reputation: 245

Responsiveness problem between devices of different sizes

I am developing an application that will run on two devices, a J2 smartphone with a 5-inch display (960x540) and a 7-inch tablet (800x1280). I'm having trouble making screens responsive to both screens. I created dimens.xmls files with different dimensions for the respective screens, as shown below.

I created two dimension files.

enter image description here

where in the large-hdpi are the font sizes, icons, margins and paddings for the tablet's 7 inch screen.

enter image description here

and in this dimension, they are the sizes referring to the 5 inch screen.

Although I made the two dimension files, for each screen with different sizes, when running the application run on both devices, only the configuration contained in large-hdpi that works on both screens. If I change a font size in large-hdpi, in the preview of android studio, it already shows me the change in the 5 inch screen, and it was to change only in the 7 inch screen. So, I would like to know how I can have different sizes for these two screens.

Upvotes: 0

Views: 47

Answers (1)

kandrit
kandrit

Reputation: 44

According to the official Android documentation, these two resolutions belong to the "large" qualifier/group. This is the reason that both receive the same dimen values.

https://developer.android.com/training/multiscreen/screensizes#TaskUseSizeQuali

Although, this type of qualifiers should only be used with earlier versions of Android (versions 3.1 and earlier), which most probably you won't be supporting in your project.

Instead, you should use the smallest width qualifiers which are density-independent and you can define the exact density-independent pixels on your values files. You can read more here:

https://developer.android.com/training/multiscreen/screensizes#TaskUseSWQuali

Upvotes: 1

Related Questions