关于SDK版本,我的XML如下:
android:minSdkVersion="3"
android:targetSdkVersion="8" />
在属性下它的设置是相同的,据我在文档中看到,setTextSize应该从API级别1开始工作?
当我在API级别14上测试应用程序时它工作正常,但是我尝试过文本化的任何内容都没有改变。
希望我已经有足够的意识,我想我错过了一些明显的东西......
final Dialog dialog = new Dialog(myapp.this);
dialog.setContentView(R.layout.my_dialog);
dialog.setTitle("Change font size...");
dialog.setCancelable(true);
//bar = (SeekBar)dialog.findViewById(R.id.dialog_seekbar);
// bar.setOnSeekBarChangeListener(myapp.this);
Button OK = (Button) dialog.findViewById(R.id.dialog_button);
OK.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
small = (RadioButton) dialog.findViewById(R.id.radio_small);
medium = (RadioButton) dialog.findViewById(R.id.radio_medium);
large = (RadioButton) dialog.findViewById(R.id.radio_large);
if(small.isChecked()){
webview = (WebView) findViewById(R.id.webView);
WebSettings webSettings = webview.getSettings();
webSettings.setTextSize(WebSettings.TextSize.SMALLER);
}
else if(medium.isChecked()){
webview = (WebView) findViewById(R.id.webView);
WebSettings webSettings = webview.getSettings();
webSettings.setTextSize(WebSettings.TextSize.NORMAL);
}
else if(large.isChecked()){
webview = (WebView) findViewById(R.id.webView);
WebSettings webSettings = webview.getSettings();
webSettings.setTextSize(WebSettings.TextSize.LARGER);
}
else {
}
}
}