的TextView切断文本时,它是足够长 [英] TextView cuts off text when it is long enough

查看:88
本文介绍了的TextView切断文本时,它是足够长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有奇怪的问题,TextView的,它切断在最后文本的一部分。我的布局看起来像

I have strange problem with TextView, it cuts off part of the text at the end. My layout looks like

<LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="top|center_horizontal"
        android:gravity="top|center_horizontal"
        android:orientation="vertical" >
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_gravity="top|center_horizontal"
            android:gravity="top|center_horizontal"
            android:orientation="horizontal"
            android:layout_weight="1"
            android:layout_marginBottom="5dp">
            <Button
                android:id="@+id/btnPreviousQuestion"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/selector_arrow_left"
                android:clickable="true"
                android:visibility="gone" >
            </Button>
            <TextView
                android:id="@+id/txtQuestion"
                style="@style/question_text"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:gravity="top|center_horizontal"
                android:layout_weight="1"
                 />
            <Button
                android:id="@+id/btnNextQuestion"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="10dp"
                android:background="@drawable/selector_arrow_right"
                android:clickable="true" >
            </Button>
        </LinearLayout>
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_weight="1"
            android:orientation="horizontal" >
            <WebView
                android:id="@+id/wvMultimediaQuestion"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom|center_horizontal"
                android:layout_marginLeft="50dp"
                android:layout_marginRight="55dp"
                android:layout_weight="1"
                android:visibility="gone" />
        </LinearLayout>
    </LinearLayout>

和txtQuestion切断文本时,它是足够长的时间。什么是错的,没有任何人知道?

and txtQuestion cuts off text when it is long enough. What is wrong, does anybody know ?

推荐答案

请使用这些属性的

    android:lines="1"
    android:scrollHorizontally="true"
    android:ellipsize="end"

将追加...结尾。但是,这并不能解决蜂窝标签的问题

will append "..." at the end. But this will not solve problem in honeycomb tab

因此​​,对于蜂窝平板电脑添加以下atttibute也

So for honeycomb tablet add the following atttibute also

android:singleLine="true" 

在另一方面,如果你需要跑马灯效果

On the other hand if you require marquee effect

android:singleLine="true"
android:ellipsize="marquee" 
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true" 
android:focusable="true" 
android:focusableInTouchMode="true

这篇关于的TextView切断文本时,它是足够长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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