java - Create a custom layout size? -
some info
i'm trying optimize app 5.1" device, have layout , large layout ( optimized 7.0" ) if try put device device 5.1" instead of changing size of main layout open , change large layout size...
question?
so question is, how can create layout custom size? create layout-normall if it's possible , set 5.1" because main layout optimized 5.0"...
ps: (i'm yet using constraintlayout , it's not working on switching device ) pic releated :
it sounds using screen size resource qualifiers supply alternate layouts:
/res/layout/mylayout.xml /res/layout-large/mylayout.xml
i recommend stop doing this, , never use screen size resource qualifiers in future. you've noticed, difference between "normal" , "large" unclear, , plenty of phones count "large".
you're better off using smallest width resource qualifiers:
/res/layout/mylayout.xml /res/layout-sw360dp/mylayout.xml /res/layout-sw600dp/mylayout.xml
providing alternate resources in way gives precise control on when particular layout used. note can use number here; sw487dp
totally valid.
you can read more here: https://developer.android.com/guide/topics/resources/providing-resources.html
the smallestwidth of device takes account screen decorations , system ui. example, if device has persistent ui elements on screen account space along axis of smallestwidth, system declares smallestwidth smaller actual screen size, because screen pixels not available ui. thus, value use should actual smallest dimension required layout (usually, value "smallest width" layout supports, regardless of screen's current orientation).
some values might use here common screen sizes:
320, devices screen configurations such as: 240x320 ldpi (qvga handset), 320x480 mdpi (handset), 480x800 hdpi (high-density handset)
480, screens such 480x800 mdpi (tablet/handset).
600, screens such 600x1024 mdpi (7" tablet).
720, screens such 720x1280 mdpi (10" tablet).
Comments
Post a Comment