0
我試圖在Android中創建一個類似this(10秒鐘)的模態彈出效果。我想彈出一個帶有TextView和WebView的「窗口」,上面有一個動畫,背景模糊或變暗。我已經搜索過並且遇到了AlertDialog,PopupWindow和Activity對話框,但我不確定哪些是最適合的。什麼是實現這一目標的最佳方式?如何使用動畫創建Android Modal彈出窗口?
我試圖在Android中創建一個類似this(10秒鐘)的模態彈出效果。我想彈出一個帶有TextView和WebView的「窗口」,上面有一個動畫,背景模糊或變暗。我已經搜索過並且遇到了AlertDialog,PopupWindow和Activity對話框,但我不確定哪些是最適合的。什麼是實現這一目標的最佳方式?如何使用動畫創建Android Modal彈出窗口?
使用對話框此:
public class AppDialog extends Dialog {
View mainView;
public AppDialog(@NonNull Context context) {
super(context);
mainView = LayoutInflater.from(context).inflate(R.layout.app_date_picker_dialog,null);
addContentView(mainView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
}
}
呼叫您的活動:
AppDialog dialog = new AppDialog(context);
dialog.show();
謝謝!你將如何動畫彈出和關閉對話框? –