简体   繁体   中英

Android: widget and layout

How can I create a widget layout compatible with all display and any density ? Thanks

That isn't really possible using one file.

The best option to use is to create one layout, then create one style file. Then in the style place styles for the elements in your layout. Then you can create a dimens file in layout-small, layout-normal, layout-large, layout-xlarge. Here you can place display size related dimensions in density independant measurements, such as dp and sp.

Then of course, you will need to do the whole song and dance with creating drawables for all various densities.

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