d-m*_*man 2 android dialog webview
我想在我的webview中打开twitter auth而不是在浏览器中打开,任何好的教程如何在对话框中使用webview并将其加载到对话框中?
小智 5
Context mContext = this;
AlertDialog.Builder alert = new AlertDialog.Builder(mContext);
alert.setTitle("Riga");
WebView wv = new WebView(mContext);
String html = "<html><body>some html here</body></html>";
wv.loadData(html, "text/html", "UTF-8");
alert.setView(wv);
alert.setIcon(R.drawable.icon);
alert.setPositiveButton("Yes", new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog, int id){
Toast.makeText(getApplicationContext(), "Success", Toast.LENGTH_SHORT).show();
}
});
alert.setNegativeButton("No", new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog, int id){
Toast.makeText(getApplicationContext(), "Fail", Toast.LENGTH_SHORT).show();
}
});
alert.show();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12128 次 |
| 最近记录: |