0

我无法在对话框中显示一些文本。当用户忘记他们的密码时,我使用“忘记密码”TextView来显示一条消息,解释当他们输入他们的电子邮件地址时会发生什么。这个布局是:

<TextView
    android:id="@+id/forgotpasswordtextview"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/forgotpassword"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:textColor="@color/md_text_yellow"
    android:gravity="right" />

它在 a 内部<LinearLayout></LinearLayout>,具有以下属性:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/base_panel"
    android:orientation="vertical"
    android:padding="6dip" >

它从单行视图开始,然后扩展到四行视图。

在对话框构造函数中,我有一个布局说明:

    mParent = LayoutInflater.from(context).inflate(R.layout.login, null);

    setContentView(mParent, new ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

我将其更改为使对话框高度为 600(它有效 - 一个垂直拉伸的对话框)并且TextView仍然只显示四行,因此它不会被其父级压碎。

这可能是什么原因造成的?

编辑:

将 更改为TextViewandroid:textAppearance="?android:attr/textAppearanceSmall"同一点切断字符串,显示三行。我现在想知道这是否是字符串问题而不是TextView问题。

原始字符串是:

Please enter your registered email and we will send you details of how to reset your password. If you do not know your email then please contact us.

它在以下位置中断:

Please enter your registered email and we will send you details of how to reset your password. If you do not

带有小文本(三行)和

Please enter your registered email and we will send you details of how to reset your password. If you do not know

中等文本(四行)。

我输入的新测试字符串是:

0________ 1________ 2________ 3________ 4________ 5________ 6________ 7________ 8________ 9________ 10_______ 11_______ 12_______ 13_______ 14_______ 15_______ 16_______ 17_______

它在以下位置中断:

0________ 1________ 2________ 3________ 4________ 5________ 6________ 7________ 8________ 9________ 10_______ 11_______ 12_______ 13_______ 14_______

带有小文本(五行)和

0________ 1________ 2________ 3________ 4________ 5________ 6________ 7________ 8________ 9________ 10_______ 11_______

中等文本(六行)。

进一步编辑:

缩短字符串表明它正在切断最后一行或两行。可能像Android: Last line of textview cut off。在字符串文件中添加换行符会给我另一行,但不是整个字符串!

4

1 回答 1

3

尝试为您的文本视图使用以下属性

安卓:m​​axLines="10"

机器人:椭圆形=“无”

机器人:单行=“假”

于 2012-12-14T14:15:32.143 回答