android_自定义notification

上一节中,我们实现了自己的notification,相信大家都有了一些认识,在最后也接受了利用RemoteView来实现自定义布局的notification,这里就来举一个示例,方便理解。
      第一步:新建一个工程,命名为cusNotification;
      第二步:新建一个布局文件(即自定义的notification的布局文件:custom_notification.xml,内容如下:
  1.   
  2.     android:layout_width="match_parent"  
  3.     android:layout_height="match_parent" >  
  4.       
  5.    
  6.         android:id="@+id/image"  
  7.         android:layout_width="wrap_content"  
  8.         android:layout_height="fill_parent"  
  9.         android:layout_alignParentLeft="true"  
  10.         android:layout_marginRight="10dp"  
  11.         android:contentDescription="@string/Image" />  
  12.       
  13.    
  14.         android:id="@+id/title"  
  15.         android:layout_width="wrap_content"  
  16.         android:layout_height="wrap_content"  
  17.         android:layout_toRightOf="@id/image"  
  18.         style="@style/NotificationTitle" />  
  19.       
  20.    
  21.         android:id="@+id/text"  
  22.         android:layout_width="wrap_content"  
  23.         android:layout_height="wrap_content"  
  24.         android:layout_toRightOf="@id/image"  
  25.         android:layout_below="@id/title"  
  26.         style="@style/NotificationText" />  
  27.       
  28.   
复制代码
  第三步:新建上面布局文件中引用到的styyes.xml文件,代码如下:
  1.   
  2.   
  3.