admin
2020-10-14 b2fc802bf35143ed957a86d95e2de49934ea9ea5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.lcjian.library.dialog;
 
import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.Gravity;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
 
import com.lcjian.lcjianlibrary.R;
 
public class BottomDialog extends Dialog {
 
    public BottomDialog(Context context) {
        super(context, android.R.style.Theme_NoTitleBar_Fullscreen);
    }
 
    @Override
    public void onCreate(Bundle saveInstance) {
        WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
        layoutParams.height = LayoutParams.WRAP_CONTENT;
        layoutParams.width = LayoutParams.MATCH_PARENT;
        layoutParams.dimAmount = 0.5f;
        onWindowAttributesChanged(layoutParams);
        getWindow().setBackgroundDrawable(new ColorDrawable());
        getWindow().setWindowAnimations(R.style.dialogstyle);
        getWindow().setGravity(Gravity.BOTTOM);
        getWindow().setAttributes(layoutParams);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    }
}