在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(安卓)Studio学习:中级控件:使用Intent进行页面之间数据传
  3. LinearLayout(线性布局)
  4. 捕获Android文本输入框的软键盘完成(Done)按键消息
  5. Android在View中的动画
  6. android刮刮乐
  7. Android(安卓)与 native C 利用本地socket进行消息传递
  8. Android开发EditText属性
  9. Android(安卓)APK 反编译工具

随机推荐

  1. 【Android(安卓)Studio(一)】从Eclipse迁移
  2. TextView 借助Linkify,使用自定义模式设置
  3. android:xmlns的作用以及自定义
  4. Android(安卓)Activity启动流程分析
  5. Android作业之组建通讯与后台服务 1
  6. EPSON Printer 打印机 Sdk For Android
  7. 《Frida高级逆向》训练营,7 月再开营!
  8. Android(安卓)Studio中学习Android(安卓)
  9. 每天记录学习的新知识 :蓝牙BLE数据传输记
  10. Android之隐式意图(Intent)如何查找匹配