您好,我在我的应用中使用了webview
,并在mysql的webview
中显示了数据。
如何在等式pic文本之后像pic2那样制作文本? 谢谢
xml
<WebView
android:id="@+id/webview_exam"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:background="@color/grey_10" />
编码
@SuppressLint({"SetJavaScriptEnabled", "SdCardPath", "ClickableViewAccessibility"})
public static void enableWVCache(WebView webView, String data) {
webView.getSettings().setDomStorageEnabled(true);
webView.setWebChromeClient(new WebChromeClient());
webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR);
webView.getSettings().setAllowFileAccess(true);
webView.getSettings().setAppCacheEnabled(true);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadsImagesAutomatically(true);
//webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
//webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING);
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setDisplayZoomControls(false);
webView.getSettings().setDatabaseEnabled(true);
webView.setHapticFeedbackEnabled(false);
webView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
webView.getSettings().setLoadWithOverviewMode(true);
webView.setBackgroundColor(Color.parseColor("#e6e6e6"));
/*webView.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
return (event.getAction() == MotionEvent.ACTION_MOVE);
}
});*/
webView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
return true;
}
});
webView.loadData(data, "text/html", "UTF-8");
// webView.loadDataWithBaseURL("file:///android_asset/web/style.css",data, "text/html", "UTF-8",null);
}