这里说两个常用的弹窗类, PopupWindow和AlertDialog.
我的理解就是, PopupWindow较为随性, 可以在任意位置弹窗, 比如你经常看到的朋友圈点赞的那个小的弹窗....那AlertDialog就很正经了, 位置固定在中央, 比如无比烦人的更新提示就是用的它, 大多数都是消息标题+内容+确定按钮+取消按钮. 好, 不多废话了.
?...用API16的虚拟机.
android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder...(this);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
?...当然, 以下代码可以浓缩成一行代码, 但是不够直观, 我更喜欢清晰一点的代码.
android.support.v7.app.AlertDialog.Builder builder = new android.support.v7