请看下面的代码
<TableRow
android:id="@+id/tableRow13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp" >
<TextView
android:id="@+id/textView22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:textSize="12sp"
android:text="@string/r_new_event"
android:layout_marginLeft="5dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/textView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Meeting with people i have never seen before in my entire life lol"
android:ellipsize="marquee"
android:maxLength="10"
android:singleLine="true"
android:fadingEdge="horizontal"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:textColor="#ffffff"
android:textSize="12sp"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
</TableRow>
如果文本长度超过 10 个字母,则此尝试是选中文本。但不幸的是,这段代码不起作用。我试过飞蛾模拟器和安卓手机。这里有什么问题?
更新
以下是我的新代码,它仍然无法正常工作
<TextView
android:id="@+id/textView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Meeting with people i have never seen before in my entire life lol"
android:ellipsize="marquee"
android:maxLength="10"
android:singleLine="true"
android:fadingEdge="horizontal"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:textColor="#ffffff"
android:textSize="12sp"
android:layout_marginLeft="10dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:freezesText="true"
android:textAppearance="?android:attr/textAppearanceSmall" />