在android中的webview中,可以对文本内容进行对齐,具体方法如下
 public class MainActivity extends Activity {     @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);         String htmlText = " %s ";        String myData = "Hello World! This tutorial is to show demo of displaying text with justify alignment in WebView.";         WebView webView = (WebView) findViewById(R.id.webView1);        webView.loadData(String.format(htmlText, myData), "text/html", "utf-8");    }}


activity_main.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    tools:context=".MainActivity" >     <WebView        android:id="@+id/webView1"        android:layout_width="match_parent"        android:layout_height="match_parent"/> </RelativeLayout>

更多相关文章

  1. android中的两端对齐
  2. android中的两端对齐
  3. android中的两端对齐
  4. android中的两端对齐
  5. android 多项对话框
  6. Android_布局属性大全
  7. android中的两端对齐
  8. android中的两端对齐
  9. SpannableString使用详解

随机推荐

  1. golang 数组存的是什么
  2. golang 怎么设计一个栈
  3. golang 是面向对象的么
  4. golang 怎么拼接字符串
  5. golang 如何读取csv文件
  6. golang有web框架吗
  7. golang 是否需要orm
  8. golang获取当前时间是第几周
  9. golang如何利用多核
  10. golang 如何运行