我想使android textview顯示標題和距離。我的代碼如下Android文本視圖 - 將一些常量(非裁剪)文本添加到文本的末尾
<TextView android:id="@+id/name" android:textSize="15dip"
android:ellipsize="end" android:maxLines="2"
android:layout_width="fill_parent" android:layout_height="wrap_content" />
在填充2行後,文本視圖中的文本會自動裁剪。如果我在文本上追加距離。距離也得到了裁剪。我需要保留標題裁剪,但不是距離。
例如
"This is title line 1
and this is title lin... (2 Mi)"
我沒有這通過測量一個字符的尺寸(使用平均),並手動裁剪我的主文本,和所附的距離文本。 avgCharSize = txtName.getPaint()。measureText(「iw.H012()R」)/ 10.0f; //由於我的文本包含字符,符號和數字 – Ramesh 2012-03-14 07:12:41