The specific code is as follows:
package ; import ; import ; import ; import ; import ; import ; import ; import ; import ; import ; import ; public class BottomDialog extends Dialog { @BindView() TextView chang; @BindView() TextView exite; @BindView() TextView cancel; private BottomDialogAlertListener listener; private Object param; private String text1; private String text2; private String cansleText; public BottomDialog(Context context, BottomDialogAlertListener listener, Object param, String text1, String text2, String cansleText) { super(context, .dialog1); = listener; = param; this.text1 = text1; this.text2 = text2; = cansleText; } @Override protected void onCreate(Bundle savedInstanceState) { (savedInstanceState); setContentView(.dialog_bottom); (this); setCancelable(false); setCanceledOnTouchOutside(false); if (listener != null) { (this, param); } setView(); } private void setView() { (text1); (text2); (cansleText); } @OnClick({, , }) public void onViewClicked(View view) { switch (()) { case : if (listener != null) { (this,param); } break; case : if (listener != null) { (this,param); } break; case : if (listener != null) { (this,param); } break; } } @Override public void show() { (); /** * Set the width to full screen, and set it behind the show */ layoutParams = getWindow().getAttributes(); = ; = .MATCH_PARENT; = .WRAP_CONTENT; getWindow().getDecorView().setPadding(0, 0, 0, 0); getWindow().setAttributes(layoutParams); } } <!-- Customizedialogstyle --> <style name="dialog1" parent="@android:style/"> <item name="android:windowFrame">@null</item> <item name="android:windowIsFloating">true</item> <item name="android:windowIsTranslucent">false</item> <item name="android:windowNoTitle">true</item> <item name="android:background">@android:color/transparent</item> <item name="android:windowBackground">@android:color/transparent</item> <item name="android:backgroundDimEnabled">true</item> <item name="android:layout_width">match_parent</item> <!-- Enter and exit animation --> <item name="android:windowAnimationStyle">@style/BottomDialogAnimation</item> </style> <!-- Enter and exit animation --> <style name="BottomDialogAnimation"> <!--Enter --> <item name="android:windowEnterAnimation">@anim/dialog_enter_from_bottom</item> <!--quit--> <item name="android:windowExitAnimation">@anim/dialog_exit_to_bottom</item> </style> <!--dialog_enter_from_bottom --> <?xml version="1.0" encoding="utf-8"?> <set xmlns:andro> <translate android:duration="200" android:fromYDelta="100%p" android:toYDelta="0"></translate> </set> <!--dialog_exit_to_bottom --> <?xml version="1.0" encoding="utf-8"?> <set xmlns:andro> <translate android:duration="200" android:fromYDelta="0" android:toYDelta="100%p"></translate> </set>
Summarize
The above is the example code popped up from the bottom to the top of the Android custom dialog introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support for my website!