Android WebView的使用
2010-07-19 23:13:00 来源:WEB开发网@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
result.cancel();
}
});
builder.setCancelable(false);
builder.create();
builder.show();
return true;
}
public boolean onJsPrompt(WebView view,String url,String message,String defaultValue,final JsPromptResult result){
LayoutInflater inflater = LayoutInflater.from(Test.this);
final View v = inflater.inflate(R.layout.prom_dialog, null);
//设置 TextView对应网页中的提示信息
((TextView)v.findViewById(R.id.TextView_PROM)).setText(message);
//设置EditText对应网页中的输入框
((EditText)v.findViewById(R.id.EditText_PROM)).setText(defaultValue);
Builder builder = new Builder(Test.this);
builder.setTitle("带输入的对话框 ");
builder.setView(v);
builder.setPositiveButton(android.R.string.ok, new AlertDialog.OnClickListener(){
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
String value = ((EditText)v.findViewById(R.id.EditText_PROM)).getText().toString();
result.confirm(value);
}
});
builder.setNegativeButton(android.R.string.cancel, new AlertDialog.OnClickListener(){
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
result.cancel();
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener(){
@Override
public void onCancel(DialogInterface dialog) {
// TODO Auto-generated method stub
result.cancel();
}
});
builder.create();
builder.show();
更多精彩
赞助商链接