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>
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
相關文章
Android應用的Material設計的布局兼容性的一些要點總結
這篇文章主要介紹了Android應用的Material設計的布局兼容性的一些要點總結,文中還給了一個RecyclerView布局管理的例子,需要的朋友可以參考下2016-04-04
Android編程UI設計之GridView和ImageView的用法
這篇文章主要介紹了Android編程UI設計之GridView和ImageView的用法,結合實例形式較為詳細的分析了Android中GridView和ImageView組件的相關方法使用技巧,需要的朋友可以參考下2016-01-01
Android中系統(tǒng)自帶鎖WalkLock與KeyguardLock用法實例詳解
這篇文章主要介紹了Android中系統(tǒng)自帶鎖WalkLock與KeyguardLock用法,結合實例形式較為詳細的分析了WalkLock與KeyguardLock的功能、作用、使用方法與相關注意事項,需要的朋友可以參考下2016-01-01
Android創(chuàng)建簡單發(fā)送和接收短信應用
收發(fā)短信應該是每個手機最基本的功能之一了,即使是許多年前的老手機也都會具備這項功能,而Android 作為出色的智能手機操作系統(tǒng),自然也少不了在這方面的支持。今天我們開始自己創(chuàng)建一個簡單的發(fā)送和接收短信的應用,需要的朋友可以參考下2016-04-04
Android基礎入門之dataBinding的簡單使用教程
DataBinding 是谷歌官方發(fā)布的一個框架,顧名思義即為數(shù)據(jù)綁定,下面這篇文章主要給大家介紹了關于Android基礎入門之dataBinding的簡單使用,文中通過實例代碼介紹的非常詳細,需要的朋友可以參考下2022-06-06
Android Studio開發(fā)環(huán)境搭建教程詳解
android studio是最近比較火的開發(fā),那么android studio開發(fā)環(huán)境怎么搭建呢?下面通過本文給大家記錄下Android Studio開發(fā)環(huán)境搭建教程詳解,需要的朋友參考下吧2017-11-11

