Android 中的兩端對齊實(shí)例詳解
在android中的webview中,可以對文本內(nèi)容進(jìn)行對齊,具體方法如下
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實(shí)現(xiàn)的文件上傳功能示例
這篇文章主要介紹了Golang+Android基于HttpURLConnection實(shí)現(xiàn)的文件上傳功能,結(jié)合具體實(shí)例形式分析了Android基于HttpURLConnection的客戶端結(jié)合Go語言服務(wù)器端實(shí)現(xiàn)文件上傳功能的操作技巧,需要的朋友可以參考下2017-03-03
Android Handler主線程和一般線程通信的應(yīng)用分析
本篇文章小編為大家介紹,Android Handler主線程和一般線程通信的應(yīng)用分析。需要的朋友參考下2013-04-04
android設(shè)備間實(shí)現(xiàn)無線投屏的示例代碼
Android提供了MediaProjection來實(shí)現(xiàn)錄屏,通過MediaProjection可以獲取當(dāng)前屏幕的視頻流,而視頻流需要通過編解碼來壓縮進(jìn)行傳輸,通過MediaCodec可實(shí)現(xiàn)視頻的編碼和解碼,這篇文章主要介紹了android設(shè)備間實(shí)現(xiàn)無線投屏,需要的朋友可以參考下2022-06-06
Android基于OpenCV實(shí)現(xiàn)圖像脫色
脫色是將彩色圖像轉(zhuǎn)換為灰度圖像的過程。同時(shí),它也是數(shù)字打印,風(fēng)格化的黑白照片渲染以及許多單通道圖像處理應(yīng)用程序中的基本工具。本文講述基于OpenCV實(shí)現(xiàn)圖像脫色的步驟2021-06-06
Android仿今日頭條滑動(dòng)頁面導(dǎo)航效果
這篇文章主要為大家詳細(xì)介紹了Android仿今日頭條滑動(dòng)頁面導(dǎo)航效果的相關(guān)資料,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-01-01
android使用Socket通信實(shí)現(xiàn)多人聊天應(yīng)用
這篇文章主要為大家詳細(xì)介紹了android使用Socket通信實(shí)現(xiàn)多人聊天應(yīng)用,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-03-03
仿網(wǎng)易新聞客戶端頭條ViewPager嵌套實(shí)例
正確使用requestDisallowInterceptTouchEvent(boolean flag)方法,下面為大家介紹下外層ViewPager布局的實(shí)例,感興趣的朋友可以參考下哈2013-06-06

