在选取框的Andr​​oid不滚动 [英] Marquee not scrolling in android

查看:108
本文介绍了在选取框的Andr​​oid不滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用字幕的功能在我的Andr​​oid应用程序,并正在使用该code为实现这一目标:

I want to use the feature of marquee in my android app and am using this code for achieving the goal:

 <TextView
    android:id="@+id/marqueetext"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:ellipsize="marquee"
    android:fadingEdge="horizontal"
    android:lines="1"
    android:marqueeRepeatLimit="marquee_forever"
    android:scrollHorizontally="true"
    android:text="hello all how are you"
    android:textColor="#ff4500" 
    />

MarqueeText = (TextView)ShowTheMessages.this.findViewById(R.id.marqueetext);
        MarqueeText.setSelected(true);

我不知道为什么它不working.I经历了许多相关的帖子走了,但还没有找到solution.Please帮助me.Thanks提前。

I don't know why it is not working.I have gone through many related posts but have not found the solution.Please help me.Thanks in advance.

推荐答案

改变这一行,并尝试...

change this line and try...

android:text="hello all how are you hello all how are you hello all how are you hello all how are you"
TextView txtView=(TextView) findViewById(R.id.marqueetext);
txtView.setSelected(true);

 <TextView
    android:id="@+id/marqueetext"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:ellipsize="marquee"
    android:fadingEdge="horizontal"
    android:lines="1"
    android:marqueeRepeatLimit="marquee_forever"
    android:scrollHorizontally="true"
    android:text="hello all how are you hello all how are you hello all how are you hello all how are you"
    android:textColor="#ff4500" 
    />

或另一个例子是...

or another example is...

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TextView
        android:id="@+id/marqueetext"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:lines="1"
        android:ellipsize="marquee"
        android:fadingEdge="horizontal"
        android:marqueeRepeatLimit="marquee_forever"
        android:scrollHorizontally="true"
        android:textColor="#ff4500"
        android:text="hello all how are you hello all how are you hello all how are you hello all how are you hello all how are you" />
</RelativeLayout>

这篇关于在选取框的Andr​​oid不滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆