background image

android:layout_height="wrap_content"
android:layout_toRightOf="@id/image"
android:layout_below="@id/title"
style="@style/NotificationText" />

</RelativeLayout>

ii.

布局文件控件样式

res/values/styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="NotificationText">

<item name="android:textColor">

?android:attr/textColorPrimary

</item>

</style>
<style name="NotificationTitle">

<item name="android:textColor">

?android:attr/textColorPrimary

</item>

<item name="android:textStyle">

bold

</item>

</style>

</resources>

iii. 代码实现

/**

* 创建自定义通知布局
* API10之前
*/

public void

createCustomNotification(){

//取得NotificationManager实例

NotificationManager

notifiManager=

(NotificationManager)

this

.getSystemService(Context.

NOTIFICATION_SERVICE

);