簡(jiǎn)單學(xué)習(xí)Android TextView
本文為大家分享了TextView的簡(jiǎn)單學(xué)習(xí)資料,供大家參考,具體內(nèi)容如下
XML的幾個(gè)特殊屬性
android:autoLink 用于指定是否將文本轉(zhuǎn)換成可點(diǎn)擊的超鏈接形式,它的屬性值有none,web,email,phone,map或all
android:drawBottom 用于將圖片添加到文本的低端 同理還有上,左,右
android:hint 當(dāng)文本為空時(shí),默認(rèn)顯示的是什么
android:Grivaity 文本的對(duì)齊方式
android:inputType 顯示的文本類型
Mainactivity.XML代碼
<LinearLayout 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" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:orientation="vertical" tools:context=".MainActivity" > <TextView android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="666" /> <TextView android:id="@+id/textview2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:text="測(cè)試是否為單行模式" /> <TextView android:id="@+id/textview3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="http://www.baidu.com" android:autoLink="web" /> </LinearLayout>
mainACtivity.java
<LinearLayout 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" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:orientation="vertical" tools:context=".MainActivity" > <TextView android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="666" /> <TextView android:id="@+id/textview2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:text="測(cè)試是否為單行模式" /> <TextView android:id="@+id/textview3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="http://www.baidu.com" android:autoLink="web" /> </LinearLayout>
運(yùn)行結(jié)果
上述中的鏈接如果把a(bǔ)pk導(dǎo)入到手機(jī)上真的能連接到百度,是不是很神奇….
- android TextView設(shè)置中文字體加粗實(shí)現(xiàn)方法
- Android TextView設(shè)置背景色與邊框的方法詳解
- android實(shí)現(xiàn)上下滾動(dòng)的TextView
- android TextView多行文本(超過3行)使用ellipsize屬性無效問題的解決方法
- android TextView不用ScrollViewe也可以滾動(dòng)的方法
- Android編程開發(fā)之TextView文字顯示和修改方法(附TextView屬性介紹)
- Android控件系列之TextView使用介紹
- Android TextView字體顏色設(shè)置方法小結(jié)
- android TextView加下劃線的方法
- Android實(shí)現(xiàn)TextView中文字鏈接的4種方式介紹及代碼
相關(guān)文章
Android實(shí)用控件自定義逼真相機(jī)光圈View
這篇文章主要為大家詳細(xì)介紹了Android實(shí)用控件自定義逼真相機(jī)光圈,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-08-08Android獲取手機(jī)配置信息具體實(shí)現(xiàn)代碼
下面為大家介紹下使用android獲取手機(jī)配置信息的具體過程,感興趣的朋友可以參考下哈,希望對(duì)你有所幫助2013-06-06Android 動(dòng)畫之RotateAnimation應(yīng)用詳解
本節(jié)講解旋轉(zhuǎn)動(dòng)畫效果RotateAnimation方法的應(yīng)用,有需要的朋友可以參考下2012-12-12Android使用音頻信息繪制動(dòng)態(tài)波紋
這篇文章主要介紹了Android使用音頻信息繪制動(dòng)態(tài)波紋 的相關(guān)資料,需要的朋友可以參考下2016-02-02Android實(shí)現(xiàn)閃屏及注冊(cè)和登錄界面之間的切換效果
這篇文章主要介紹了Android實(shí)現(xiàn)閃屏及注冊(cè)和登錄界面之間的切換效果,實(shí)現(xiàn)思路是先分別實(shí)現(xiàn)閃屏、注冊(cè)界面、登錄界面的活動(dòng),再用Intent將相關(guān)的活動(dòng)連接起來,實(shí)現(xiàn)不同活動(dòng)之間的跳轉(zhuǎn),對(duì)android 實(shí)現(xiàn)閃屏和界面切換感興趣的朋友一起看看吧2016-11-11移動(dòng)端android上line-height不居中的問題的解決
現(xiàn)在越來越多的移動(dòng)界面使用rem適配,最近發(fā)現(xiàn)了移動(dòng)端android上line-height不居中的問題,今日就來介紹一下解決的方法,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2018-03-03Android編程實(shí)現(xiàn)手機(jī)自帶內(nèi)部存儲(chǔ)路徑的獲取方法
這篇文章主要介紹了Android編程實(shí)現(xiàn)手機(jī)自帶內(nèi)部存儲(chǔ)路徑的獲取方法,涉及Android針對(duì)掛載點(diǎn)信息的獲取技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-11-11