Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@manojdcoder
Created March 9, 2017 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manojdcoder/7ae72215f00388407fd60a53f9ae9510 to your computer and use it in GitHub Desktop.
Save manojdcoder/7ae72215f00388407fd60a53f9ae9510 to your computer and use it in GitHub Desktop.
Android Custom Notification
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/custom_image_notification_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/custom_image_notification_left_icon"
android:layout_width="44dp"
android:layout_height="44dp"
android:layout_marginRight="10dp"
android:layout_gravity="center_vertical"
android:src="@drawable/appicon" />
<ImageView
android:id="@+id/custom_image_notification_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:src="@drawable/banner" />
</LinearLayout>
RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.custom_image_notification);
contentView.setImageViewResource(R.id.custom_image_notification_left_icon, R.drawable.appicon);
contentView.setImageViewBitmap(R.id.custom_image_notification_image, R.drawable.banner);
notification.contentView = contentView;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment