Android examples for User Interface:Dialog
Set Dialog width
//package com.java2s; import android.app.Dialog; import android.util.DisplayMetrics; import android.view.WindowManager; public class Main { public static void SetDialogw(Dialog dialog, WindowManager windowManager) { DisplayMetrics dm = new DisplayMetrics(); windowManager.getDefaultDisplay().getMetrics(dm); WindowManager.LayoutParams params = dialog.getWindow() .getAttributes();//w ww .j a v a 2s . co m params.width = dm.widthPixels; dialog.getWindow().setAttributes(params); } }