【发布时间】:2017-06-08 00:21:59
【问题描述】:
我修复了以下问题。一个简单的改变。将android:lines="1" 替换为android:singleLine="true"。
目前,我的应用程序将小部件中的文本显示为 Marquee。它在除 4.0 版本之外的所有 Android 操作系统中都按预期工作。我已经在 API 级别 14 的模拟器中进行了测试,并且文本没有滚动(选取框)。下面是用于在 Marquee 效果中显示文本的布局 xml。
<?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="fill_parent">
<TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:lines="1"
android:background="@android:color/background_dark"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:textColor="@android:color/white"
android:focusable="true"
android:focusableInTouchMode="true"
android:duplicateParentState="true"
android:textSize="20dp">
<requestFocus android:focusable="true" android:focusableInTouchMode="true"
android:duplicateParentState="true" />
</TextView>
</RelativeLayout>
帮我解决这个问题。
提前致谢。
【问题讨论】:
-
您可以在下方添加您的解决方案并将其标记为已接受,否则您可以删除您的问题。
-
我修复了以下问题。一个简单的改变。将 android:lines="1" 替换为 android:singleLine="true"。
标签: android-layout android-widget marquee android-4.0-ice-cream-sandwich