Android 3.0后,dialog基于fragment,并对之前版本提供兼容支持库,也就是说对于开发者而言,dialog是基于DialogFragment的,但此时需要在应用中加入相关的兼容库。
对DialogFragment 有兴趣的可以自行百度。反正是个好东西,用于替代dialog的。
大屏广告页面弹框:我不知道android里有没有专门的名词,大概类似摩拜那种,或者天猫那种那个对话框了,
实现思路就是大的屏幕对话框,嵌套一个webview。这个基本上共用的,所以直接复制就可以了
下面放代码:
public class WebViewDialogFragment extends DialogFragment { Context mContext; String webUrl=""; public static WebViewDialogFragment newInstance(String webUrl) { Bundle bundle = new Bundle(); bundle.putString("url", webUrl); WebViewDialogFragment dialog = new WebViewDialogFragment(); dialog.setArguments(bundle); return dialog; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext=getActivity(); Bundle bun