欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android TextView對(duì)齊的兩種方法

 更新時(shí)間:2017年07月21日 15:09:42   投稿:lqh  
這篇文章主要介紹了Android TextView對(duì)齊的兩種方法的相關(guān)資料,在開(kāi)發(fā)Android APP 的時(shí)候經(jīng)常會(huì)用到TextView 輸入用戶信息或者其他信息,總是不能對(duì)齊,這里提供兩種方法,需要的朋友可以參考下

Android TextView對(duì)齊的兩種方法

 在寫(xiě)Android布局文件時(shí), 經(jīng)常碰到如下圖的TextView左右對(duì)齊的情況, 即姓名和手機(jī)號(hào)碼縱向?qū)R。、 

 

第一種方法:  在姓和名之間加空格, 但是如果用鍵盤(pán)的空格會(huì)在一些機(jī)型上對(duì)齊、一些機(jī)型上不對(duì)齊。 

     \u3000是全角空格;  \u0020是半角空格,效果跟在英文輸入法下直接敲鍵盤(pán)空格一樣。 這里要用全角空格,  占位一個(gè)漢字。

<TextView
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:text="姓\(chéng)u3000\u3000名"
  android:textColor="#6e6e6e"
  android:textSize="13dp" />

第二種方法: 比較low。    用3個(gè)TextView, 第一個(gè)是“姓”、第二個(gè)是invisible(利用不顯示但占位的特性)的2個(gè)漢字如“姓名”, 第三個(gè)是“名”。

<TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="姓"
            android:textColor="#6e6e6e"
            android:textSize="13dp" />
          <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="姓名"
            android:visibility="invisible"
            android:textColor="#6e6e6e"
            android:textSize="13dp" />
          <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="名"
            android:textColor="#6e6e6e"
            android:textSize="13dp" />



以上就是關(guān)于Android TextView 文本對(duì)齊的方法詳解,如有疑問(wèn)還請(qǐng)大家留言,或者到本站社區(qū)交流,共同進(jìn)步,感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!

相關(guān)文章

最新評(píng)論