Tag Archives: How will you create a custom Notification in Android with a custom Layout?

How will you create a custom Notification in Android with a custom Layout?

By | September 15, 2012

This sample application does that. First create an xml for your notification. custom_notification.xml [xml] <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dp" > <ImageView android:id="@+id/image" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentLeft="true" android:layout_marginRight="10dp" /> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/image" style="Custom Notification Title" /> <TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/image" android:layout_below="@id/title" style="Custom Notification Text" /> </RelativeLayout> [/xml] Now the java code. [java] package com.coderzheaven.customnotification; import android.app.Activity;… Read More »