android中的文本视图剪辑

android中的文本视图剪辑,android,Android,我使用的是自定义Toast,如果字段太长,文本视图有时会被删除: XML: 从android:gravity=“fill”到android:ellipsize=“marquee”,我几乎尝试了所有东西。似乎什么都不管用。有人知道为什么吗?也许这样的东西可以帮助你: 它会重新调整文本视图(和文本)的大小,以适合其他视图 我一定是弄错了。我不认为仅仅为了防止文本视图的剪辑就需要外部库。在xmlWell中有没有办法做到这一点呢?这实际上取决于很多因素。假设您有一条100字符长的消息。然后,您需要屏

我使用的是自定义Toast,如果字段太长,文本视图有时会被删除:

XML:



从android:gravity=“fill”到android:ellipsize=“marquee”,我几乎尝试了所有东西。似乎什么都不管用。有人知道为什么吗?

也许这样的东西可以帮助你:


它会重新调整文本视图(和文本)的大小,以适合其他视图

我一定是弄错了。我不认为仅仅为了防止文本视图的剪辑就需要外部库。在xmlWell中有没有办法做到这一点呢?这实际上取决于很多因素。假设您有一条100字符长的消息。然后,您需要屏幕宽度至少为~800px。但若你们只有短消息,比如说30个字符,所有字符都可以放在屏幕上,所以不会出现剪辑。但是我建议您,如果适用的话,使用linearlayout而不是relativelayout,并在textview上使用fill\u parent或match\u parent。我还有其他几个文本视图,彼此左右对齐。使用线性布局没有任何意义。我使用wrap_内容自动设置TextView的大小。它应该自动展开,因为相对布局也是包装内容
 <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/toast" >

   <TextView
                android:id="@+id/textView"
                android:layout_width="wrap_content"
                android:layout_gravity="fill_horizontal"
                android:layout_height="wrap_content"
                android:layout_alignBaseline="@+id/someotherview"
                android:layout_alignBottom="@+id/someotherview"
                android:layout_alignLeft="@+id/someotherview"
                android:text=""
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textStyle="bold" />

        </RelativeLayout>