I try to make a custom view with this xml code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF0000">
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/ic_launcher"/>
</LinearLayout>
and i run notification with this code:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.notification_layout);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
.setContent(remoteViews).setSmallIcon(R.drawable.ic_launcher);
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(20, mBuilder.build());
}
This is the result:
why "match_parent" does not use the full height of the notification ?
I want the red zone does the same height as the notification, without use "dip" unity. I use android 4.2.2. Thank you !