我的应用中有几个TextView,应该有3行。这适用于Android 3+,但在Android 2.3上,我也想支持,这些字段恰好有2行。我也试过TextView.setLines(3);在代码中,但似乎没有帮助。这是我的TextView:
<TextView
d1p1:lines="3"
d1p1:maxLines="3"
d1p1:minLines="3"
d1p1:ellipsize="end"
d1p1:text="Some Text"
d1p1:textAppearance="?android:attr/textAppearanceMedium"
d1p1:layout_width="fill_parent"
d1p1:layout_height="55dp"
d1p1:id="@+id/detailsTextView"
d1p1:layout_below="@+id/locationTextView"
d1p1:textSize="13dp"
d1p1:textColor="@color/app_darkgray"
d1p1:background="@color/app_dark_background"
d1p1:layout_marginLeft="@dimen/sr_horizontal_padding"
d1p1:layout_marginRight="@dimen/sr_horizontal_padding" />
将高度设置为wrap_content也不起作用。
答案 0 :(得分:4)