【发布时间】:2013-10-02 13:48:27
【问题描述】:
我想显示一段长文本如下。这是来自 Flipboard 的快照。
为了达到这样的效果,我尝试使用2个TextViews。
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="40sp"
android:text="T" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="76dp"
android:text="op British supermarket Tesco (LSE: TSCO) (NASDAQOTH: TSCDY.US) is due to announce its half year results on" />
</LinearLayout>
我得到以下结果。
非常接近。但不是我想要的。这是因为第 2 行和第 3 行最左对齐。第2行和第3行最左边的空间被TextView占据,大字体。
有没有更好的技术可以使用,比如 Flipboard 中的那种?
【问题讨论】:
-
只需使用
HTML标签并在TextView或WebView中使用Html.fromHtml()加载您的数据。 -
@Andrew Spannable text 是个好主意。谢谢。我将其添加为答案。
标签: android