Android的通知跑马灯不工作 [英] Android notification Marquee not working

查看:314
本文介绍了Android的通知跑马灯不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序有一个自定义的通知,具有如下的布局。我的问题是,字幕不工作。 plz帮助我。在此先感谢

In my app there is a custom notification, with the following layout. My problem is that the marquee doesn't working. plz help me. Thanks in advance

> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/notification_layout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="10dp" >

    <ImageView
        android:id="@+id/notification_image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:layout_marginRight="10dp"
        android:background="@drawable/icon" />

    <TextView
        android:id="@+id/notification_title"
        style="@style/NotificationTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@+id/notification_image"
        android:text="asaadsadad" />

    <TextView
        android:id="@+id/notification_message"
        style="@style/NotificationText"
        android:layout_width="wrap_content"
        android:ellipsize="marquee"
        android:lines="1"
        android:marqueeRepeatLimit="marquee_forever"
        android:layout_height="wrap_content"
        android:layout_below="@+id/notification_title"
        android:layout_toRightOf="@+id/notification_image"
        android:text="@string/four_day_delay_msg"
        android:focusable="true" />

</RelativeLayout>

在可以添加通知滚动??

Can add scroll in notification??

推荐答案

好了,我花了相当多的时间来研究这一点,我认为它是安全的,说有一些主要的障碍,为了实现这一目标需要克服。值得注意的是,有自己的自定义通知使用选框谷歌企业应用套件的一些例子,但是它在自己的蜂巢Android 4.0的版本,所以也许他们固定的,我要解决的问题。
另外我还没有看到字幕在谷歌应用程序,如谷歌音乐实现应选取框的长曲名称或艺术家。

Well, I've spent quite a bit of time researching this and I think it's safe to say there are some major hurdles to overcome in order to accomplish this. It's worth noting that there are some examples of Google Apps using marquee in their custom notifications, however it's in their HoneyComb Android 4.0 release, so perhaps they fixed the issues I'm about to address. Also I haven't seen marquee implemented in Google Apps like Google Music which should marquee long song names or artists.

我爱编号列表...


  1. 带字幕的问题。这是一个挑剔的设置,不仅你有设置省略号,你必须确保在包含它获得焦点的观点劳斯莱斯,否则它永远不会选取框。所以很自然我第一次尝试是试图通知创建之后专注于TextView的。 Android的不喜欢的是,到#2。

  2. 然后我继续研究自动滚动字幕TextViews。我原本以为这一次,可惜没有。一些真正聪明的人决定他们不喜欢选取框的限制,因此他们反而创造了autofocuses本身的自定义组件。因此,字幕将始终运行。但后来当我把它添加到自定义通知的Andr​​oid再次表示反对。我想自定义通知,不喜欢自定义组件,我甚至尝试创建一个自定义的RelativeLayout专注于当onFinishInflate()被调用TextView的。

  3. 有这么多的研究,你能做到的,我只是放弃了。无论是仰望如何在自定义通知使用自定义组件。我看了一下,至少15分钟,没有运气。或查找如何在自定义通知重点项目,似乎更是奇怪。这两个我的搜索没有结果,但有没有很多这样的事情StackOverflow的问题。可能会产生一些运气在这里张贴的新问题。

资源...

自定义组件 - 自动滚动字幕的TextView - http://androidbears.stellarpc.net/?p=185

Custom Component - AutoScrolling Marquee TextView - http://androidbears.stellarpc.net/?p=185

自定义组件 - 相对布局onFinishInflate() - 安卓:如何创建自定义组件 - <一个href=\"http://www.devdaily.com/java/jwarehouse/android/core/java/android/widget/TwoLineListItem.java.shtml\">http://www.devdaily.com/java/jwarehouse/android/core/java/android/widget/TwoLineListItem.java.shtml

Custom Component - Relative Layout onFinishInflate() - Android : how to create custom component - http://www.devdaily.com/java/jwarehouse/android/core/java/android/widget/TwoLineListItem.java.shtml

谷歌应用程序以跑马灯的例子在自定义通知(TextView的标题是:notification_title) - <一个href=\"http://developer.android.com/resources/samples/HoneycombGallery/res/layout/notification.html\">http://developer.android.com/resources/samples/HoneycombGallery/res/layout/notification.html

Google App with example of Marquee in custom notification (TextView titled: notification_title) - http://developer.android.com/resources/samples/HoneycombGallery/res/layout/notification.html

这篇关于Android的通知跑马灯不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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