繁体   English   中英

Android表:ImageView和TextView没有可见的长文本

[英]Android table: ImageView and TextView with no visible long text

我有两列的TableLayout。 如果TextView中的文本比屏幕尺寸长一点(6或7个符号),则这6或7个符号不可见。 如果文本较长且带有更多符号,则它们是可见的。 它是ListView的一部分,我会在ImageView中动态加载文本内容和图像。 我希望TextView中的文本始终可见,无论它持续多长时间。 我能做什么?

这是我的布局xml内容:

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    >

<TableLayout
    android:id="@+id/message_table_layout" 
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:stretchColumns="1"
    >
<TableRow>
<ImageView
    android:id="@+id/message_image" 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_vertical"
/>
<TextView
    android:id="@+id/message_title"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Technical Support Representative"
    android:layout_below="@+id/message_image"
    android:layout_gravity="center_vertical"
/>
</TableRow>
</TableLayout>
</RelativeLayout>

这是我的文字:

    String messageTitleText = "<b> Xxxxxxx xxx xxx xx<br/> Xxxxxxxxxx<br/> Xxxxxxxxxxx<br/> xxxxxxxxxxxxxxxx<br/> xxx xxxxxxxxx x xxxxxxxx xx 1234567890<br/> xxxxxxx xxxx<br/> xxxxxxx xxxx xxxx";
    messageTitle.setText(Html.fromHtml(messageTitleText));

隐藏“ 1234”,“ 567890”后,我的HTC不显示字符。

谢谢

尝试这个

<TextView
    android:id="@+id/message_title"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:maxLines="4"
    android:lines="4"
    android:text="Technical Support Representative"
    android:layout_below="@+id/message_image"
    android:layout_gravity="center_vertical"
/>

现在我使用它,没关系:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >

<ImageView
    android:id="@+id/message_image"
    android:layout_gravity="center"
    android:layout_width="120px"
    android:layout_height="48dp"
    android:src="@drawable/ic_launcher" />

<TextView
    android:id="@+id/message_title"
    android:layout_gravity="center"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="TextView" />

</LinearLayout>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM