我有垂直排列的幾個完全相同的TextView
S(同緣離開,同樣填充左,相同位置的左側)。它們可以具有不同的文本大小,以及文本可以以不同的字母開頭。問題在於,儘管TextView
與左邊對齊,但其中的文本不是。是否有可能實現這一目標?在每個首字母前刪除/分解多餘的空格?或者我應該尋找一些特定的字體?下面刪除多餘的空間,因此可以適當左對齊
圖片顯示的情況。有三個TextView
與左邊對齊,但每個字母從不同的點開始。 小號和米具有相同的尺寸,但不對齊。 i相當小,差距更大。
我所看到的:
我想要什麼:
代碼的例子:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="m"
android:textColor="#88FF0000"
android:textSize="250dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="s"
android:textColor="#8800FF00"
android:textSize="250dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="220dp"
android:text="i"
android:textColor="#880000FF"
android:textSize="25dp" />
</RelativeLayout>
的代碼粘貼,你試過嗎? – RajeshVijayakumar
我不認爲這可能與一個TextView。你可能會使用畫布自己繪製文本,使用來自'Paint.getTextWidths()'的信息,但我不知道從那裏返回的寬度是否包含周圍的空白(我的猜測是它贏了)幫助)。 – Tim
我確實認爲TextView可以實現,它只需要一個MonoSpaced字體。 – Machinarius