Android 中的兩端對齊實例詳解
更新時間:2017年01月24日 09:06:59 投稿:lqh
這篇文章主要介紹了Android 中的兩端對齊實例詳解的相關(guān)資料,需要的朋友可以參考下
在android中的webview中,可以對文本內(nèi)容進行對齊,具體方法如下
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>
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
相關(guān)文章
Golang+Android基于HttpURLConnection實現(xiàn)的文件上傳功能示例
這篇文章主要介紹了Golang+Android基于HttpURLConnection實現(xiàn)的文件上傳功能,結(jié)合具體實例形式分析了Android基于HttpURLConnection的客戶端結(jié)合Go語言服務器端實現(xiàn)文件上傳功能的操作技巧,需要的朋友可以參考下2017-03-03
Android Handler主線程和一般線程通信的應用分析
本篇文章小編為大家介紹,Android Handler主線程和一般線程通信的應用分析。需要的朋友參考下2013-04-04
android使用Socket通信實現(xiàn)多人聊天應用
這篇文章主要為大家詳細介紹了android使用Socket通信實現(xiàn)多人聊天應用,具有一定的參考價值,感興趣的小伙伴們可以參考一下2018-03-03

