Android 中的两端对齐实例详解
更新时间:2017年01月24日 09:06:59 投稿:lqh
这篇文章主要介绍了Android 中的两端对齐实例详解的相关资料,需要的朋友可以参考下
在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>
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
相关文章
Golang+Android基于HttpURLConnection实现的文件上传功能示例
这篇文章主要介绍了Golang+Android基于HttpURLConnection实现的文件上传功能,结合具体实例形式分析了Android基于HttpURLConnection的客户端结合Go语言服务器端实现文件上传功能的操作技巧,需要的朋友可以参考下2017-03-03
Android Handler主线程和一般线程通信的应用分析
本篇文章小编为大家介绍,Android Handler主线程和一般线程通信的应用分析。需要的朋友参考下2013-04-04


最新评论