Android WebView的使用
2010-07-19 23:13:00 来源:WEB开发网//设置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();
return true;
}
//设置网页加载的进度条
public void onProgressChanged(WebView view,int newProgress){
Test.this.getWindow().setFeatureInt(Window.FEATURE_PROGRESS, newProgress*100);
super.onProgressChanged(view, newProgress);
}
//设置应用程序的标题
public void onReceivedTitle(WebView view,String title){
Test.this.setTitle(title);
super.onReceivedTitle(view, title);
}
});
btn.setOnClickListener(new Button.OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
String url = et.getText().toString();
更多精彩
赞助商链接