Android中TextView怎么用

這篇文章給大家分享的是有關(guān)Android中TextView怎么用的內(nèi)容。小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過來看看吧。

創(chuàng)新互聯(lián)公司長(zhǎng)期為上千余家客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊(duì)從業(yè)經(jīng)驗(yàn)10年,關(guān)注不同地域、不同群體,并針對(duì)不同對(duì)象提供差異化的產(chǎn)品和服務(wù);打造開放共贏平臺(tái),與合作伙伴共同營(yíng)造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為庫(kù)爾勒企業(yè)提供專業(yè)的成都網(wǎng)站設(shè)計(jì)、網(wǎng)站制作,庫(kù)爾勒網(wǎng)站改版等技術(shù)服務(wù)。擁有十多年豐富建站經(jīng)驗(yàn)和眾多成功案例,為您定制開發(fā)。

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é)果

Android中TextView怎么用

感謝各位的閱讀!關(guān)于“Android中TextView怎么用”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!

當(dāng)前名稱:Android中TextView怎么用
當(dāng)前鏈接:http://muchs.cn/article30/gpjgso.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供手機(jī)網(wǎng)站建設(shè)、域名注冊(cè)、面包屑導(dǎo)航定制網(wǎng)站、定制開發(fā)、App開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都app開發(fā)公司