Custom Dialog with no title and full screen in Android

for doing this you can fallow below two procedures:
a) here set your screen width and width to the dialog
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
    lp.copyFrom(dialog.getWindow().getAttributes());
    lp.width = width;
    lp.height = height;
    dialog.getWindow().setAttributes(lp);
get width and height of the device like this for any device it will fills :
WindowManager manager = (WindowManager) getSystemService(Activity.WINDOW_SERVICE);
    int width, height;
    LayoutParams params;

    if (Build.VERSION.SDK_INT > VERSION_CODES.FROYO) {
        width = manager.getDefaultDisplay().getWidth();
        height = manager.getDefaultDisplay().getHeight();
    } else {
        Point point = new Point();
        manager.getDefaultDisplay().getSize(point);
        width = point.x;
        height = point.y;
    }


or
b) in your styles create a style like this then
 <style name="DialogTheme" parent="android:Theme.Dialog">

    <item name="android:layout_width">fill_parent</item>
    <item name="android:layout_height">fill_parent</item>


    <!-- No backgrounds, titles or window float -->
    <item name="android:windowBackground">@null</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowIsFloating">false</item>
</style>
create a dialog object like this
dialog = new Dialog(this, R.style.DialogTheme);

Comments

Popular posts from this blog

code to display .pdf,.text,.DOC,.DOCX,.doc extension files exists in SDCard

Best working code to set Date limits on Date Picker Dialog,in Android