简体   繁体   中英

Android: How to programmatically set dialog size?

I want do set size (in px) of dialog based on screen resolution, so I have to set dialog size programmatically during runtime.

Dialog layout is defined in xml with all standard views, so it would be nice to have better way to set dialog size than override-in top view's onMeasure(...).

(Android 1.5 SDK)

I would suggest reading Google's Dev Guide on supporting multiple screen sizes.

http://developer.android.com/guide/practices/screens_support.html

Using pixels for view sizes is a bad idea.

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