notification-Notification Layout 文件的使用

问题描述

Notification Layout 文件的使用

我想给 Notification Dynamic 设置布局,查找了很多资料,说使用一个布局文件。我不想引用布局文件,我想设置动态布局。在我定义了所有的控件后,我使用下面的句子来引用:

RemoteViews contentView = null;
contentView = new RemoteViews(this.getPackageName(),0000);

它总是在”0000”空间引用一个布局文件,但是这个”0000”是 LinearLayout的一个ID。现在出现错误:

couldn't inflate view for notification org.MM.MMShow/0x4308f
android.content.res.Resources$NotFoundException: Resource ID #0x0

解决方案

很显然你提供的这个ID对程序来说是错误的
它没找到你的这个Resource
Clean一下
采用R.id.myLinearLayout来定位再试试

时间: 2022-12-22

notification-Notification Layout 文件的使用的相关文章

android layout-菜鸟的用Android创建的project中的layout文件夹是空的怎么回事啊?

问题描述 菜鸟的用Android创建的project中的layout文件夹是空的怎么回事啊? 菜鸟的用Android创建的project中的layout文件夹是空的怎么回事啊?而且src包也是空的,怎么回事啊? 解决方案 我最近也遇到了同样的问题,你的有解决了么 解决方案二: 要不要截个图看看...按照新建工程的向导来做,不应该出现此情况的.file->new->android application progect ->输入包名 progect名字..->next next...

xml-Android Studio layout文件

问题描述 Android Studio layout文件 各位前辈,当我用android studio构建项目时,自动在layout文件夹下生成activity和content xml文件,当我继续构建新的activity时,也会自动生成新的activity的content文件,请问,这两个文件有什么区别?怎么取消自动构建content文件? 解决方案 Android layout文件中 '?' 的作用Android Studio ------Dynamic layout previewAndr

layout文件夹中activity_main.xml与fragment_main.xml文件的处理记录

androidSDK更新到22.6后新建立项目时在layout文件夹下面出现了activity_main.xml与fragment_main.xml,这是为了在平板开发中使用碎片,但是让不需要碎片的人不习惯,自己做了如下更改 (1)将activity_main.xml中内容替换为fragment_main.xml中内容,删除fragment_main.xml,activity_main.xml内容如下 1 <RelativeLayout xmlns:android="http://sche

android 左右页面滑动(滑屏)增加layout文件 而不是drawable(还有activity)

android 左右页面滑动(滑屏)增加layout文件 而不是drawable(还有activity)    |字号 订阅 ViewFlipper + GestureDetector 简单的实现:   这里还需实现 implements OnGestureListener . 另外需要4个动画的配置文件: 说到Animation,我们先看下如何在Android中实现自定义Animation.自定义的Animation是以XML格式定义的,定义好的XML文件存放在res/anim中.   一般的

android eclipse写layout文件失效问题解决

设置 xml 文件的代码提示功能 打开 Eclipse 依次选择 Window > Preferences > Xml > Editor > Content Assist > Auto activation > Prompt when these characters are inserted ,设置框中默认是 <=: ,( 现在将它改为: 以下为引用内容:  <=:.abcdefghijklmnopqrstuvwxyz(,ABCDEFGHIJKLMNOPQ

Android开发入门(四)发送通知 4.2 Notification通知

到目前为止,想必大家已经都熟悉使用Toast去给用户显示信息了.尽管使用Toast很方便,但是Toast显 示的通知并不是永久存储的.它只在屏幕上显示一小段时间,然后就消失了.如果它包含一些特别重要的信 息,如果用户没有观察屏幕,那么用户就很容易错过它. 对于那些重要的信息,应该采用一种更加持 久保存的方法.在这种情况下,应该使用NotificationMnanger(消息管理器)去显示一个长久的信息,这个 消息被显示在了StatusBar(状态栏)上面,使用用户能够很容易地看见. 接下来展示如

转 android notification 的总结分析

分类  Android的notification有以下几种: 1>普通notification 图1 标题,通过NotificationCompat.Builder.setContentTitle(String title)来设置 大图标,通过NotificationCompat.Builder.setLargeIcon(Bitmap icon)来设置 内容,通过NotificationCompat.Builder.setContentText("ContentText")来设置

自定义状态栏notification布局

布局定义custom_notification.xml <?xml version="1.0" encoding="utf-8"?>   <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"       android:layout_width="match_parent"       android:layout

Android实现为Notification加上一个进度条的方法_Android

本文实例讲述了Android实现为Notification加上一个进度条的方法.分享给大家供大家参考,具体如下: package com.notification; import android.app.Activity; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Intent;