listview - listview之后,如果放置 textview,则 android elipsized textview将不起作用

  显示原文与译文双语对照的内容

我发现 elipsized textview有非常奇怪的行为。 如果在listview之后放置 textview,则不滚动文本,例如。 如果将textview放置在布局的开头,它就会工作。 可能 是 什么病 呢?


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

<!--
 <TextView
 android:text="START | lunch 20.00 | Dinner 60.00 | Travel 60.00 | Doctor 5000.00 | lunch 20.00 | Dinner 60.00 | Travel 60.00 | Doctor 5000.00 | END"
 android:id="@+id/MarqueeText1"
 android:layout_width="fill_parent"
 android:layout_height="40dp"
 android:singleLine="true"
 android:ellipsize="marquee"
 android:marqueeRepeatLimit="marquee_forever"
 android:scrollHorizontally="true"
 android:paddingLeft="15dip"
 android:paddingRight="15dip"
 android:focusable="true"
 android:focusableInTouchMode="true"
 android:freezesText="true"/>
-->


 <include layout="@layout/reminder_header_item"/>

 <ListView
 android:id="@+id/lv_trade_points"
 android:layout_width="match_parent"
 android:layout_height="300dp"
> 
 </ListView>

 <View
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="match_parent"
 android:layout_height="1dp"
 android:layout_marginBottom="1dp"
 android:layout_alignParentBottom="true"
 android:background="#DADADC"/>
 <TextView
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:text="START | lunch 20.00 | Dinner 60.00 | Travel 60.00 | Doctor 5000.00 | lunch 20.00 | Dinner 60.00 | Travel 60.00 | Doctor 5000.00 | END"
 android:id="@+id/MarqueeText1"
 android:layout_width="fill_parent"
 android:layout_height="40dp"
 android:singleLine="true"
 android:ellipsize="marquee"
 android:marqueeRepeatLimit="marquee_forever"
 android:scrollHorizontally="true"
 android:paddingLeft="15dip"
 android:paddingRight="15dip"
 android:focusable="true"
 android:focusableInTouchMode="true"
 android:freezesText="true"/>
 <View
 android:layout_width="match_parent"
 android:layout_height="1dp"
 android:layout_marginBottom="1dp"
 android:layout_alignParentBottom="true"
 android:background="#DADADC"/>

</LinearLayout>

我的布局

时间:

要滚动,你的textView高度必须是 wrap_content

如果你在dp中指定,你将无法达到目标


<TextView
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:text="START | lunch 20.00 | Dinner 60.00 | Travel 60.00 | Doctor 5000.00 | lunch 20.00 | Dinner 60.00 | Travel 60.00 | Doctor 5000.00 | END"
 android:id="@+id/MarqueeText1"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:singleLine="true"
 android:ellipsize="marquee"
 android:marqueeRepeatLimit="marquee_forever"
 android:scrollHorizontally="true"
 android:paddingLeft="15dip"
 android:paddingRight="15dip"
 android:focusable="true"
 android:focusableInTouchMode="true"
 android:freezesText="true"/>

...