![](/img/trans.png)
[英]How to add space between Textview and Tabbedview in android
[英]How to add leading white space (spaces) in TextView (Android)
當我使用setText()時,我試圖在我的TextView中顯示的字符串中添加前導空格(空格),但是TextView只是將它們從String中刪除。
例如,說我要顯示“ 328”。 我叫textView.setText(“ 328”),但TextView中顯示的是“ 328”。 TextView將始終顯示:
328
代替:
328
請記住,我必須在使用.setText()而不是通過資源時解決此問題。 我也嘗試在其前面加上“ \\ u00A0”,“ \\ u0020”和“&#160”,但它們不起作用。
使用以下方法在文本之前添加空格。
textView.setText(" "+"328");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.