Android: How to programmatically set the size of a dialog?

I want to set the size (in pixels) of the dialog box depending on the screen resolution, so I need to set the size of the dialog programmatically at runtime.

The layout of the dialog is defined in xml with all the standard views, so it would be nice to have a better way to set the size of the dialog than the redefined top view onMeasure (...).

(Android 1.5 SDK)

+4
source share
1 answer

I would suggest reading the Google Dev guide on supporting multiple screen sizes.

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

Using pixels for viewing sizes is a bad idea.

+3
source

All Articles