0

I know it's been asked before but I cant find a solution to my problem

Both devices have the same size 2650 * 1600 px

One with size 10.5" has 287 ppi

The other size 11" has 276 ppi

As I understand these tow are of the same density group, but the elements on the screen doesn't align well can anyone help me with creating a separate dimens.xml?

Thanks!

user3698465
  • 185
  • 1
  • 10
  • 1
    Call `getResources().getConfiguration()` on your `Activity` to get a `Configuration` object. Examine the value of the `densityDpi` field of that `Configuration` object and see what it is for your two test devices. There is no guarantee that those two devices share a common density bucket. – CommonsWare Oct 05 '21 at 10:41
  • Thanks @CommonsWare S7: dltr sw752dp w1204dp h680dp 340dpi lrg land finger S6: ldltr sw711dp w1137dp h639dp 360dpi lrg hdr widecg land finger So my folders should be values-sw752/dimens.xml and values-sw711dp/dimens.xml ? – user3698465 Oct 05 '21 at 12:14
  • Probably not. The real solution is to fix your layout, so you might consider asking a separate question where your [mcve] includes the layout, shows the results on these two devices, and explains in detail what you feel needs to be fixed. – CommonsWare Oct 05 '21 at 12:20

1 Answers1

0

Thanks to @CommonsWare comment! I printed getResources().getConfiguration() and saw that one has in it :

sw752dp and the other had sw711dp

So I added the folders res/values-sw752dp and res/values-711dp with dimens.xml unique for each one and it worked!

These are the getResources().getConfiguration():

S7:{1.0 ?mcc?mnc [en_US] ldltr sw752dp w1204dp h680dp 340dpi lrg land finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 2560, 1600) mAppBounds=Rect(0, 0 - 2560, 1498) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_90} s.1 desktop/d dc/d ?dcui ?dcaf bts=0 ff=0 bf=0 themeSeq=0}

S6:{1.0 ?mcc?mnc [en_US] ldltr sw711dp w1137dp h639dp 360dpi lrg hdr widecg land finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 2560, 1600) mAppBounds=Rect(0, 0 - 2560, 1492) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_90} s.1 desktop/d dc/d bts=0 ff=0 bf=0}

user3698465
  • 185
  • 1
  • 10