Alignment in Html.fromHtml()

前端 未结 7 842
眼角桃花
眼角桃花 2020-12-06 05:52

Is alignment working in HTML.fromHtml() in a TextView?

I tried

Test

and

7条回答
  •  感动是毒
    2020-12-06 06:16

    Although it is possible to use alignment using a webview instead of a TextView, and loading the html from a file placed in assets:

    public class ViewWeb extends Activity {
        WebView webview;
        @Override
        public void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.webview);
    
           webview = (WebView) findViewById(R.id.webView1);
           webview.loadUrl("file:///android_asset/index.html");
        }
    }
    

提交回复
热议问题