自定义通知滚动字幕文本不工作的android [英] Custom notification marquee text doesnt work android

查看:250
本文介绍了自定义通知滚动字幕文本不工作的android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

喜我尝试让我通知经理滚动字幕文本的一部分,但不工作我想这样的:

Hi im trying to make part of my text in the notification manager marquee but doesnt work i tried this:

  <TextView
    android:id="@+id/title_text"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:ellipsize="marquee"
    android:fadingEdge="horizontal"
    android:gravity="bottom"
    android:marqueeRepeatLimit="marquee_forever"
    android:scrollHorizontally="true"                                     
    android:focusable="true"
    android:focusableInTouchMode="true"              
    android:singleLine="true"
    android:textSize="15sp"
    android:textStyle="bold" >
  </TextView>

在我的.java我使用远程视窗:

and in my .java i use remoteview:

Notification notification = new Notification(icon, tickerText, when);
RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.notification);

contentView.setTextViewText(R.id.title_text, "This is a very long text which is not fitting in the screen so it needs to be marqueed");

我想有滚动字幕为title_text 这是一个很长的文本这是不是在屏幕接头,这样它需要marqueed

但选取框不工作只是停留静电我可以做什么?

but the marquee doesnt work just stays static what i can do?

感谢您。

推荐答案

我改变了我的xml:

  <TextView
    android:id="@+id/title_text"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:ellipsize="marquee"
    android:fadingEdge="horizontal"
    android:gravity="bottom"
    android:marqueeRepeatLimit="marquee_forever"
    android:scrollHorizontally="false"                                     
    android:focusable="true"
    android:focusableInTouchMode="true"              
    android:singleLine="true"
    android:textSize="15sp"
    android:textStyle="bold" 
    android:textColor="#fff">
    <requestFocus/> 
  </TextView>

我加入&LT; requestFocus的/方式&gt; 现在我的字幕完美的作品

i added <requestFocus/> and now my marquee works perfect.

这篇关于自定义通知滚动字幕文本不工作的android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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