title: Android remoteviews in notification
body: <p>I am developing a music player application. The player is in a service. When a song starts to play i want to show a custom notification with remoteViews.</p>
  <p>What i designed for the layout is:</p>
  <p><img src="https://i.stack.imgur.com/zWPNc.jpg" alt="android studio screenshot" /></p>
  <p>but unfortunately the textviews are gone when the notification is built:</p>
  <p><img src="https://i.stack.imgur.com/ZfMT7.jpg" alt="device screenshot" /></p>
  <p>the code for the layout is as follows:</p>
  <p>notification_player.xml</p>
  <pre><code>    &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;RelativeLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      android:orientation=&quot;vertical&quot; android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;&gt;
  
      &lt;ImageView
          android:layout_width=&quot;140dp&quot;
          android:layout_height=&quot;140dp&quot;
          android:id=&quot;@+id/album_art&quot; /&gt;
  
      &lt;RelativeLayout
          android:layout_width=&quot;fill_parent&quot;
          android:layout_height=&quot;fill_parent&quot;
          android:id=&quot;@+id/wrapper&quot;
          android:layout_toRightOf=&quot;@+id/album_art&quot;
          android:layout_alignBottom=&quot;@+id/album_art&quot;&gt;
  
          &lt;LinearLayout
              android:orientation=&quot;horizontal&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_alignParentBottom=&quot;true&quot;
              android:layout_centerHorizontal=&quot;true&quot;
              android:id=&quot;@+id/player&quot;
              android:layout_marginBottom=&quot;10dp&quot;&gt;
  
              &lt;ImageView
                  android:layout_width=&quot;wrap_content&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:id=&quot;@+id/prev&quot;
                  android:layout_marginRight=&quot;5dp&quot;
                  android:src=&quot;@drawable/ic_fast_rewind&quot;
                  android:layout_gravity=&quot;center_vertical&quot; /&gt;
  
              &lt;LinearLayout
                  android:orientation=&quot;horizontal&quot;
                  android:layout_width=&quot;1dp&quot;
                  android:layout_height=&quot;fill_parent&quot;
                  android:background=&quot;#82c7c7c7&quot;&gt;&lt;/LinearLayout&gt;
  
              &lt;ImageView
                  android:layout_width=&quot;wrap_content&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:id=&quot;@+id/play&quot;
                  android:layout_marginRight=&quot;5dp&quot;
                  android:layout_marginLeft=&quot;5dp&quot;
                  android:layout_gravity=&quot;center_vertical&quot;
                  android:background=&quot;@drawable/ic_play_arrow&quot; /&gt;
  
              &lt;LinearLayout
                  android:orientation=&quot;horizontal&quot;
                  android:layout_width=&quot;1dp&quot;
                  android:layout_height=&quot;fill_parent&quot;
                  android:background=&quot;#82c7c7c7&quot; /&gt;
  
              &lt;ImageView
                  android:layout_width=&quot;wrap_content&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:id=&quot;@+id/next&quot;
                  android:layout_marginLeft=&quot;5dp&quot;
                  android:layout_gravity=&quot;center_vertical&quot;
                  android:background=&quot;@drawable/ic_fast_forward&quot; /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:orientation=&quot;horizontal&quot;
              android:layout_width=&quot;fill_parent&quot;
              android:layout_height=&quot;1dp&quot;
              android:id=&quot;@+id/divider_horizontal&quot;
              android:layout_above=&quot;@+id/player&quot;
              android:background=&quot;#82c7c7c7&quot;
              android:layout_marginBottom=&quot;10dp&quot;
              android:layout_marginRight=&quot;10dp&quot;
              android:layout_marginLeft=&quot;10dp&quot;&gt;&lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:orientation=&quot;vertical&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;fill_parent&quot;
              android:layout_above=&quot;@+id/divider_horizontal&quot;&gt;
  
              &lt;TextView
                  android:layout_width=&quot;wrap_content&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:textAppearance=&quot;?android:attr/textAppearanceMedium&quot;
                  android:id=&quot;@+id/title&quot;
                  android:layout_marginLeft=&quot;10dp&quot;
                  android:layout_marginTop=&quot;25dp&quot;
                  android:text=&quot;Title&quot;
                  style=&quot;@style/NotificationTitle&quot;/&gt;
  
              &lt;TextView
                  android:layout_width=&quot;wrap_content&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:textAppearance=&quot;?android:attr/textAppearanceSmall&quot;
                  android:text=&quot;singer&quot;
                  android:id=&quot;@+id/singer&quot;
                  android:layout_marginLeft=&quot;10dp&quot;
                  android:layout_marginTop=&quot;5dp&quot;
                  style=&quot;@style/NotificationText&quot;/&gt;
          &lt;/LinearLayout&gt;
  
          &lt;ImageView
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:id=&quot;@+id/close&quot;
              android:layout_alignParentTop=&quot;true&quot;
              android:layout_alignParentRight=&quot;true&quot;
              android:layout_marginTop=&quot;5dp&quot;
              android:layout_marginRight=&quot;5dp&quot;
              android:background=&quot;@drawable/ic_close&quot; /&gt;
  
      &lt;/RelativeLayout&gt;
      &lt;/RelativeLayout&gt;
  </code></pre>
  <p>Code in service that is showing the notification:</p>
  <pre><code>NotificationCompat.Builder builder;
  RemoteViews rv = new RemoteViews(getPackageName(),R.layout.notification_player);
          rv.setImageViewBitmap(R.id.album_art,aq.getCachedImage(item.getImage()));
  rv.setTextViewText(R.id.title, item.getTitle());
  rv.setTextViewText(R.id.singer, item.getSinger());
  rv.setOnClickPendingIntent(R.id.close, delete);
  
  
  builder = new NotificationCompat.Builder(getApplicationContext())
  .setContent(rv)
  .setSmallIcon(ir.farzamhabibi.moozik.R.drawable.ic_launcher);
  
  startForeground(10, builder.build());
  </code></pre>
  <p>Any idea what the problem is?</p>
  <p>EDIT:</p>
  <p>I tried setting the LinearLayout height to wrap content and removing the margins</p>
  <p>I even tried adding a textView in all the layouts even in the parent of all but it seems the notification is removing all the textviews.</p>