TextView Marquee 在 Android 4.0 (ISO) Widget 中不起作用
我修复了以下问题。一个简单的改变。将 android:lines="1"
替换为 android:singleLine="true"
。
目前,我的应用程序将小部件中的文本显示为选框。除 4.0 版本外,它在所有 Android 操作系统中都能按预期工作。我已经在 API 级别 14 的模拟器中进行了测试,并且文本没有滚动(字幕)。下面是用于以跑马灯效果显示文本的布局 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>
帮我解决这个问题。
提前致谢。
I fixed the below issue. A simple change. Replaced android:lines="1"
with android:singleLine="true"
.
Currently my app is showing the text in the widget as Marquee. It is working as expected in all Android OS except for 4.0 version. I have tested in Emulator with API level 14 and text is not scrolling (Marquee). Below is the layout xml being used to show the text in Marquee effect.
<?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>
Help me to fix this issue.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了澄清。
For clarification.