Code example for WebView

Methods: getSettingssetScrollBarStyle, setOnKeyListener

0
	@SuppressWarnings("deprecation") 
	@SuppressLint({ "SetJavaScriptEnabled" }) 
	private void initWebView() { 
		// �Ӳ����ļ�����չwebView 
		this.webView = (WebView) this.findViewById(R.id.webView);
		webView.getSettings().setJavaScriptEnabled(true);// ����JS
		webView.setScrollBarStyle(0);// ������������Ϊ0���Dz������������ռ䣬�����񸲸�����ҳ��
		settings = webView.getSettings();
		settings.setSupportZoom(true);
		if (settings.getTextSize() == WebSettings.TextSize.SMALLEST) {
			fontSize = 1;
		} else if (settings.getTextSize() == WebSettings.TextSize.SMALLER) {
			fontSize = 2;
		} else if (settings.getTextSize() == WebSettings.TextSize.NORMAL) {
			fontSize = 3;
		} else if (settings.getTextSize() == WebSettings.TextSize.LARGER) {
			fontSize = 4;
		} else if (settings.getTextSize() == WebSettings.TextSize.LARGEST) {
			fontSize = 5;
		} 
		// ����Ĭ�Ϻ��˰�ť�����ã��滻��WebView���IJ鿴��ʷҳ�� 
		webView.setOnKeyListener(new View.OnKeyListener() {
			@Override 
			public boolean onKey(View v, int keyCode, KeyEvent event) {
				if (event.getAction() == KeyEvent.ACTION_DOWN) {
					if ((keyCode == KeyEvent.KEYCODE_BACK)
							&& webView.canGoBack()) {
Connect your IDE to all the code out there  Get Codota for Java