TextView中只显示一个资源字符串的第一个四行 [英] TextView only displaying the first four lines of a resource string

查看:99
本文介绍了TextView中只显示一个资源字符串的第一个四行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有显示在对话框中一些文字麻烦。当用户忘记了自己的密码,我使用忘记密码的TextView 来显示一个消息,说明当他们把自己的电子邮件地址会发生什么造成这种情况的布局是:

I'm having trouble displaying some text in a dialog. When the user has forgotten their password, I use the "forgot password" TextView to display a message explaining what happens when they put their email address in. The layout for this is:

<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" />

这是在&LT;&的LinearLayout GT;&LT; / LinearLayout中&GT; 具有以下属性:

<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" >

它开始作为一个单行视图,并扩展到四线视图。

It starts as a one-line view and expands to a four-line view.

在该对话框的构造,我有一个布局指令:

Within the dialog constructor, I have a layout instruction:

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

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

我改变了这种有对话的高度是600(它的工作一垂直拉伸对话框)和的TextView 仍然只是显示四行,所以它不是被粉碎其母公司。

I changed this to have the dialog height be 600 (it worked—one vertically stretched dialog) and the TextView is STILL only displaying four lines, so it's not being crushed by its parent.

什么引起的?

编辑:

更改的TextView 的android:textAppearance =机器人:ATTR / textAppearanceSmall切串送行同一个点,显示三行。我现在想,如果这是一个字符串的问题,而不是一个的TextView 的问题。

Changing the TextView to android:textAppearance="?android:attr/textAppearanceSmall" cuts the string off at the same point, displaying three lines. I am now wondering if this is a string problem and not a TextView problem.

原始字符串是:

请输入您注册的邮件,我们会送你如何重置密码的详细信息。如果你不知道你的电子邮件,那么请与我们联系。

和它在切断:

请输入您注册的邮件,我们会送你如何重置密码的详细信息。如果不这样做

小文(三线)以及

请输入您注册的邮件,我们会送你如何重置密码的详细信息。如果你不知道

用中文字(四行)。

一个新的测试字符串,我把为:

A new test string I put in is:

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 _______

用中文字(半年线)。

进一步编辑:

缩短的字符串表明它被切断的最后一行或两行。也能像安卓TextView中的最后一行切断。添加一个新行字符串的文件给我的另一条线,而不是整个字符串!

Shortening the string suggests it is cutting off the last line or two. Could be like Android: Last line of textview cut off. Adding a newline to the string file gives me another line, but not the whole string!

推荐答案

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

Try to use the following attributes for your text view

机器人:MAXLINES =10

机器人:ellipsize =无

机器人:单线=false的

这篇关于TextView中只显示一个资源字符串的第一个四行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆