The dialog pops up from the bottom and can be modified
1. Code
mPickerDialog = new Dialog(mContext, R.style.date_picker_dialog);
mPickerDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
mPickerDialog.setContentView(R.layout.dialog_date_picker3);
//背景透明
mPickerDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
Window window = mPickerDialog.getWindow();
if (window != null) {
//弹框从底部弹出
window.setWindowAnimations(R.style.date_picker_dialog_anim);
WindowManager.LayoutParams lp = window.getAttributes();
lp.gravity = Gravity.BOTTOM;
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
window.setAttributes(lp);
}
2. style code
<style name="date_picker_dialog_anim">
<item name="android:windowEnterAnimation">@anim/dialog_in_anim</item>
<item name="android:windowExitAnimation">@anim/dialog_out_anim</item>
</style>
3. Create anim files under res to create dialog_in_anim.xml and dialog_out_anim.xml
1. The first one
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="300"
android:fromXDelta="0"
android:fromYDelta="1000"
android:toXDelta="0"
android:toYDelta="0" />
</set>
2. The second one
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="300"
android:fromXDelta="0"
android:fromYDelta="0"
android:toXDelta="0"
android:toYDelta="1000" />
</set>
Finished
Create image