title: Android notification bigcontentview : different layout on expand and collepse
body: <p>I have some problem with expand and collapse of notification bigcontentview.</p>
  
  <p>When notification is top of the list of notification , there have expand view as stated in android document, but when notification is not on the top of the list of notification, notification view become weird. I show you in the figure </p>
  
  <p>(Sorry for hiding content in image)</p>
  
  <p><strong>(1. collapsed view)</strong></p>
  
  <p><img src="https://i.stack.imgur.com/6NAnS.png" alt="enter image description here"></p>
  
  <p>In this notification contents become invisible</p>
  
  <p><strong>(2. Expanded view)</strong></p>
  
  <p><img src="https://i.stack.imgur.com/ThGXu.png" alt="enter image description here"></p>
  
  <p>after expand it all content visible, i know that this is the correct behavior. </p>
  
  <p>but I want to change layout as notification get collapsed. so i can change the layout and there content visible</p>
  
  <p><strong>Is there any solution of it? how can i get the notification is collapsed or expanded ?</strong> and how can i change layout of it during expand and collapse? So all content visible.</p>
  
  <p><strong>Is there any way to add layout differently for expanded and collapsed notification?</strong></p>
  
  <p><strong>My code is below</strong> :</p>
  
  <pre><code>@SuppressLint("NewApi")
      public void updateNotification(String text) {
  
          PendingIntent pendingIntent = null;
          PendingIntent pendingIntent1 = null;
          PendingIntent pendingIntent2 = null;
          PendingIntent pendingIntent3 = null;
          PendingIntent pendingIntent4 = null;
          PendingIntent pendingIntent5 = null;
  
          if (mRemoteViews == null) {
              Log.d("LOG", "mRemoteViews is null");
              if (Base.sharedPref.getBoolean("firsttimenotifiation", false)) {
  
                  mRemoteViews = new RemoteViews(getPackageName(),
                          R.layout.custom_notification);
              } else {
                  if (isCurrentBuildabove16()) {
                      mRemoteViews = new RemoteViews(getPackageName(),
                              R.layout.customizenotification);
                  } else {
                      mRemoteViews = new RemoteViews(getPackageName(),
                              R.layout.customnotification);
                  }
              }
          } else {
              if (MusicList.MusicFrom != MusicList.FromNotification) {
              if (mState == State.Paused || mState == State.Stopped || mState == State.Stopappnotification) {
  
  
                  try {
                      Log.e("LOG", "State.Paused || State.Stopped");
                      mRemoteViews.setImageViewResource(R.id.playpush,
                              R.drawable.playdetailfornoti);
  
                  }catch (Exception e) {}
              } else if (mState == State.Playing) {
                  try {
                      Log.e("LOG", "State.Playing");
                      mRemoteViews.setImageViewResource(R.id.playpush,
                              R.drawable.pushdetail);
  
                  } catch (Exception e) {
  
                  }
              } else if (mState == State.Retrieving) {
                  try {
  
                      mRemoteViews.setImageViewResource(R.id.playpush,
                              R.drawable.playdetailfornoti);
  
                  } catch (Exception e) {
                  }
              } else {
                  try {
                          mRemoteViews.setImageViewResource(R.id.playpush,
                                  R.drawable.pushdetail);
                  } catch (Exception e) {
                  }
              }
          }
          }
  
          Intent intent = new Intent(ACTION_TOGGLE_PLAYBACK);
          Intent intent1 = new Intent(CLOSE_NOTIFICATION);
          Intent intent2 = new Intent(ACTION_NEXT);
          Intent intent3 = new Intent(ACTION_PREVIOUS);
          Intent intent4 = new Intent(ACTION_STOP);
          intent.putExtra(CLICKFROM, APPNOTIFICATION);
  
  
          Intent newintent = new Intent(this, Splace.class);
          newintent.putExtra("newsId", MusicList.CurrentMusicEntity._id);
  
          newintent.putExtra("playfrom", "detailnotification");
          newintent
                  .putExtra("message", MusicList.CurrentMusicEntity.scrape_title);
          newintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                  | Intent.FLAG_ACTIVITY_SINGLE_TOP);
          newintent.setAction("actionstring" + System.currentTimeMillis());
  
          pendingIntent = PendingIntent.getService(getApplicationContext(),
                  REQUEST_CODE_STOP, intent, PendingIntent.FLAG_UPDATE_CURRENT);
          pendingIntent1 = PendingIntent.getService(getApplicationContext(), 0,
                  intent1, 0);
          pendingIntent2 = PendingIntent.getService(getApplicationContext(),
                  REQUEST_CODE_STOP, intent2, PendingIntent.FLAG_UPDATE_CURRENT);
          pendingIntent3 = PendingIntent.getService(getApplicationContext(),
                  REQUEST_CODE_STOP, intent3, PendingIntent.FLAG_UPDATE_CURRENT);
          PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
                  newintent, 0);
          pendingIntent4 = PendingIntent.getService(getApplicationContext(),
                  REQUEST_CODE_STOP, intent4, PendingIntent.FLAG_UPDATE_CURRENT);
  
          mRemoteViews.setOnClickPendingIntent(R.id.forward, pendingIntent2);
          mRemoteViews.setOnClickPendingIntent(R.id.backword, pendingIntent3);
          mRemoteViews.setOnClickPendingIntent(R.id.playertitle, contentIntent);
          mRemoteViews.setOnClickPendingIntent(R.id.playernewspapaer,
                  contentIntent);
          mRemoteViews.setOnClickPendingIntent(R.id.playerimage, contentIntent);
  
          mRemoteViews.setOnClickPendingIntent(R.id.playpush, pendingIntent);
  
          mRemoteViews.setOnClickPendingIntent(R.id.close, pendingIntent1);
  
      // coded differently for those below 16(which is not supported bigview) and above 16 api level
          if (isCurrentBuildabove16()) {
              mNotification = new NotificationCompat.Builder(
                      getApplicationContext())
                      .setSmallIcon(R.drawable.ic_launcher)
                      .setDeleteIntent(pendingIntent4)
                      .setPriority(Notification.FLAG_HIGH_PRIORITY)
                      .setWhen(System.currentTimeMillis())// .setContent(mRemoteViews)
                      .setOngoing(false).build();
  
              mNotification.bigContentView = mRemoteViews;
          } else {
              mNotification = new NotificationCompat.Builder(
                      getApplicationContext())
                      .setSmallIcon(R.drawable.ic_launcher)
                      .setWhen(System.currentTimeMillis())
                      .setDeleteIntent(pendingIntent4)
                      .setPriority(Notification.PRIORITY_HIGH)
                      .setContent(mRemoteViews).setOngoing(false).build();
          }
  
          if (!Base.isAppForeground) {
  
                  mNotificationManager.notify(NOTIFICATION_ID, mNotification);    
          }
      }
  </code></pre>
  
  <p>Please Help Me Thanks in advance</p>