我想將文字像10dp移動到右側,而不是TextView,而是寫入文本+光標。如何將文本視圖像10dp這樣的文本視圖向右移動?
我該怎麼做?
謝謝。
The "Hallo" is too near the border
我想將文字像10dp移動到右側,而不是TextView,而是寫入文本+光標。如何將文本視圖像10dp這樣的文本視圖向右移動?
我該怎麼做?
謝謝。
The "Hallo" is too near the border
給android:paddingStart =10dp
或android:paddingLeft =10dp
這個TextView的在佈局
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10dp"
android:text="Hello!"/>
對於詳細的解釋有關的差異是指this link
添加一些填充到TextView的開始!
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="8dp"
android:text="done!"/>
填充屬性是用來定義排列在機器人任何元件內偏移量(在你的情況的TextView),而餘量在定義圍繞偏移(或你可以調用外部)的元件的情況下使用。
所以你的情況,你需要
android:paddingStart="10dp"
你也可以使用
android:paddingRight="10dp"
,但是這與問題從右到左對齊的設備。所以它是一個很好的習慣中使用paddingStart和paddingEnd而不是使用paddingLeft和paddingRight。
你也可以在android HERE(Click Me)中找到關於視圖屬性的所有額外有用的細節。