gpt4 book ai didi

Android TextView 在 Android 2.3 中不会显示正确的行数

转载 作者:搜寻专家 更新时间:2023-11-01 08:07:46 24 4
gpt4 key购买 nike

我的应用程序中有几个 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 也不起作用。

最佳答案

经过一些研究,我的怀疑似乎是正确的。如此处 ( ellipsize multiline textview ) 所讨论,椭圆大小会导致最小/最大行属性出现问题。因此,您可能需要考虑避免使用 Ellipsize,否则,如果这不是一个选项,您可以按照其他线程中的说明使用自定义 TextView 类来解决该问题。

关于Android TextView 在 Android 2.3 中不会显示正确的行数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12900171/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com