title: Adding views dynamically displays background only
body: <p> </p>
  <blockquote>
  <p>I have used a linear layout which will have a top layout and bottom layout. The bottom layout is scrollview which has listview too.
  I have done it programmatically by adding layouts as follows,</p>
  </blockquote>
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.details);
      lv=(ListView)findViewById(R.id.listView2);
      tpaydetail=(TextView)findViewById(R.id.textView39);
      back=(ImageButton)findViewById(R.id.imageButton31);
      share=(ImageButton)findViewById(R.id.imageButton41);
      amountdetail=(TextView)findViewById(R.id.textView29);
      intrstdetail=(TextView)findViewById(R.id.textView31);
      perioddetail=(TextView)findViewById(R.id.textView33);
      Memidetail=(TextView)findViewById(R.id.textView35);
      tintdetail=(TextView)findViewById(R.id.textView37);
      LinearLayout ll=new LinearLayout(this);
      ll.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
      ll.setOrientation(LinearLayout.VERTICAL);
      RelativeLayout relativeLayouttop=(RelativeLayout)findViewById(R.id.linearLayout8);
      RelativeLayout relativeLayoutbottom=(RelativeLayout)findViewById(R.id.forscrolling);
      RelativeLayout mainview=(RelativeLayout)findViewById(R.id.scrolltest);
      ScrollView s=new ScrollView(this);
      s.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
      mainview.removeAllViews();
      relativeLayoutbottom.removeAllViews();
      s.addView(relativeLayoutbottom);
      relativeLayouttop.removeAllViews();
      ll.addView(relativeLayouttop);
      ll.addView(s);
      setContentView(ll);
  </code></pre>
  <blockquote>
  <p>And my xml code is,</p>
  </blockquote>
  <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;
  android:id=&quot;@+id/scrolltest&quot;&gt;
  &lt;RelativeLayout
      android:background=&quot;#3784ba&quot;
      android:orientation=&quot;horizontal&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;50dp&quot;
      android:layout_alignParentTop=&quot;true&quot;
      android:layout_alignParentLeft=&quot;true&quot;
      android:layout_alignParentStart=&quot;true&quot;
      android:weightSum=&quot;1&quot;
      android:id=&quot;@+id/linearLayout8&quot;&gt;
      &lt;ImageButton
          android:rotation=&quot;90&quot;
          android:paddingLeft=&quot;16dp&quot;
          android:paddingRight=&quot;16dp&quot;
          android:paddingTop=&quot;20dp&quot;
          android:paddingBottom=&quot;12dp&quot;
          android:src=&quot;@drawable/backarrow&quot;
          android:scaleType=&quot;fitXY&quot;
          android:adjustViewBounds=&quot;true&quot;
          android:cropToPadding=&quot;false&quot;
          android:background=&quot;#3784ba&quot;
          android:layout_width=&quot;50dp&quot;
          android:layout_height=&quot;match_parent&quot;
          android:id=&quot;@+id/imageButton31&quot;/&gt;
      &lt;TextView
          android:gravity=&quot;center&quot;
          android:textColor=&quot;#fff&quot;
          android:textSize=&quot;18dp&quot;
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;match_parent&quot;
          android:text=&quot;EMI Details&quot;
          android:id=&quot;@+id/textView25&quot;
          android:layout_alignParentTop=&quot;true&quot;
          android:layout_centerHorizontal=&quot;true&quot; /&gt;
      &lt;ImageButton
          android:paddingLeft=&quot;16dp&quot;
          android:paddingRight=&quot;16dp&quot;
          android:paddingTop=&quot;15dp&quot;
          android:paddingBottom=&quot;15dp&quot;
          android:src=&quot;@drawable/sharenew&quot;
          android:scaleType=&quot;fitXY&quot;
          android:adjustViewBounds=&quot;true&quot;
          android:cropToPadding=&quot;false&quot;
          android:background=&quot;#3784ba&quot;
          android:layout_width=&quot;50dp&quot;
          android:layout_height=&quot;match_parent&quot;
          android:id=&quot;@+id/imageButton41&quot;
          android:layout_alignParentTop=&quot;true&quot;
          android:layout_alignParentRight=&quot;true&quot;
          android:layout_alignParentEnd=&quot;true&quot; /&gt;
  &lt;/RelativeLayout&gt;
  &lt;RelativeLayout
  android:layout_width=&quot;match_parent&quot;
  android:id=&quot;@+id/forscrolling&quot;
  android:layout_below=&quot;@+id/linearLayout8&quot;
  android:layout_height=&quot;match_parent&quot;&gt;
  &lt;RelativeLayout
      android:background=&quot;@drawable/fortablein&quot;
      android:layout_margin=&quot;10dp&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:id=&quot;@+id/rl&quot;
      android:layout_alignParentLeft=&quot;true&quot;
      android:layout_alignParentStart=&quot;true&quot;&gt;
      &lt;LinearLayout
          android:orientation=&quot;horizontal&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;40dp&quot;
          android:layout_alignParentTop=&quot;true&quot;
          android:layout_alignParentLeft=&quot;true&quot;
          android:layout_alignParentStart=&quot;true&quot;
          android:id=&quot;@+id/linearLayout9&quot;
          android:weightSum=&quot;1&quot;&gt;
          &lt;TextView
              android:textSize=&quot;16sp&quot;
              android:background=&quot;@drawable/fortablein&quot;
              android:gravity=&quot;center&quot;
              android:textColor=&quot;#000&quot;
              android:layout_width=&quot;0dp&quot;
              android:layout_weight=&quot;0.5&quot;
              android:layout_height=&quot;match_parent&quot;
              android:text=&quot;Amount&quot;
              android:id=&quot;@+id/textView28&quot; /&gt;
          &lt;TextView
              android:layout_marginLeft=&quot;-0.5dip&quot;
              android:textSize=&quot;16sp&quot;
              android:background=&quot;@drawable/fortablein&quot;
              android:layout_width=&quot;0dp&quot;
              android:layout_weight=&quot;0.5&quot;
              android:layout_height=&quot;match_parent&quot;
              android:gravity=&quot;center&quot;
              android:textColor=&quot;#000&quot;
              android:id=&quot;@+id/textView29&quot; /&gt;
      &lt;/LinearLayout&gt;
      &lt;LinearLayout
          android:orientation=&quot;horizontal&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;40dp&quot;
          android:layout_below=&quot;@+id/linearLayout9&quot;
          android:layout_alignParentLeft=&quot;true&quot;
          android:layout_alignParentStart=&quot;true&quot;
          android:id=&quot;@+id/linearLayout10&quot;
          android:weightSum=&quot;1&quot;&gt;
          &lt;TextView
              android:layout_marginTop=&quot;-0.5dip&quot;
              android:textSize=&quot;16sp&quot;
              android:background=&quot;@drawable/fortablein&quot;
              android:gravity=&quot;center&quot;
              android:textColor=&quot;#000&quot;
              android:layout_width=&quot;0dp&quot;
              android:layout_weight=&quot;0.5&quot;
              android:layout_height=&quot;match_parent&quot;
              android:text=&quot;Interest %&quot;
              android:id=&quot;@+id/textView30&quot; /&gt;
          &lt;TextView
              android:layout_marginLeft=&quot;-0.5dip&quot;
              android:layout_marginTop=&quot;-0.5dip&quot;
              android:textSize=&quot;16sp&quot;
              android:background=&quot;@drawable/fortablein&quot;
              android:layout_width=&quot;0dp&quot;
              android:layout_weight=&quot;0.5&quot;
              android:layout_height=&quot;match_parent&quot;
              android:gravity=&quot;center&quot;
              android:textColor=&quot;#000&quot;
              android:id=&quot;@+id/textView31&quot; /&gt;
      &lt;/LinearLayout&gt;
      &lt;LinearLayout
          android:orientation=&quot;horizontal&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;40dp&quot;
          android:layout_below=&quot;@+id/linearLayout10&quot;
          android:layout_alignParentLeft=&quot;true&quot;
          android:layout_alignParentStart=&quot;true&quot;
          android:id=&quot;@+id/linearLayout11&quot;
          android:weightSum=&quot;1&quot;&gt;
          &lt;TextView
              android:layout_marginTop=&quot;-0.5dip&quot;
              android:textSize=&quot;16sp&quot;
              android:background=&quot;@drawable/fortablein&quot;
              android:gravity=&quot;center&quot;
              android:textColor=&quot;#000&quot;
              android:layout_width=&quot;0dp&quot;
              android:layout_weight=&quot;0.5&quot;
              android:layout_height=&quot;match_parent&quot;
              android:text=&quot;Period&quot;
              android:id=&quot;@+id/textView32&quot; /&gt;
          &lt;TextView
              android:layout_marginLeft=&quot;-0.5dip&quot;
              android:layout_marginTop=&quot;-0.5dip&quot;
              android:textSize=&quot;16sp&quot;
              android:background=&quot;@drawable/fortablein&quot;
              android:layout_width=&quot;0dp&quot;
              android:layout_weight=&quot;0.5&quot;
              android:layout_height=&quot;match_parent&quot;
              android:gravity=&quot;center&quot;
              android:textColor=&quot;#000&quot;
              android:id=&quot;@+id/textView33&quot; /&gt;
      &lt;/LinearLayout&gt;
      &lt;LinearLayout
          android:orientation=&quot;horizontal&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;40dp&quot;
          android:layout_below=&quot;@+id/linearLayout11&quot;
          android:layout_alignParentLeft=&quot;true&quot;
          android:layout_alignParentStart=&quot;true&quot;
          android:id=&quot;@+id/linearLayout12&quot;
          android:weightSum=&quot;1&quot;&gt;
          &lt;TextView
              android:layout_marginTop=&quot;-0.5dip&quot;
              android:textSize=&quot;16sp&quot;
              android:background=&quot;@drawable/fortablein&quot;
              android:gravity=&quot;center&quot;
              android:textColor=&quot;#000&quot;
              android:layout_width=&quot;0dp&quot;
              android:layout_weight=&quot;0.5&quot;
              android:layout_height=&quot;match_parent&quot;
              android:text=&quot;Monthly EMI&quot;
              android:id=&quot;@+id/textView34&quot; /&gt;
          &lt;TextView
              android:layout_marginLeft=&quot;-0.5dip&quot;
              android:layout_marginTop=&quot;-0.5dip&quot;
              android:textSize=&quot;16sp&quot;
              android:background=&quot;@drawable/fortablein&quot;
              android:layout_width=&quot;0dp&quot;
              android:layout_weight=&quot;0.5&quot;
              android:layout_height=&quot;match_parent&quot;
              android:gravity=&quot;center&quot;
              android:textColor=&quot;#000&quot;
              android:id=&quot;@+id/textView35&quot; /&gt;
      &lt;/LinearLayout&gt;
      &lt;LinearLayout
          android:orientation=&quot;horizontal&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;40dp&quot;
          android:id=&quot;@+id/lll&quot;
          android:layout_below=&quot;@+id/linearLayout12&quot;
          android:layout_alignParentLeft=&quot;true&quot;
          android:layout_alignParentStart=&quot;true&quot;
          android:weightSum=&quot;1&quot;&gt;
          &lt;TextView
              android:layout_marginTop=&quot;-0.5dip&quot;
              android:textSize=&quot;16sp&quot;
              android:background=&quot;@drawable/fortablein&quot;
              android:gravity=&quot;center&quot;
              android:textColor=&quot;#000&quot;
              android:layout_width=&quot;0dp&quot;
              android:layout_weight=&quot;0.5&quot;
              android:layout_height=&quot;match_parent&quot;
              android:text=&quot;Total Interest&quot;
              android:id=&quot;@+id/textView36&quot; /&gt;
          &lt;TextView
              android:layout_marginLeft=&quot;-0.5dip&quot;
              android:layout_marginTop=&quot;-0.5dip&quot;
              android:textSize=&quot;16sp&quot;
              android:background=&quot;@drawable/fortablein&quot;
              android:layout_width=&quot;0dp&quot;
              android:layout_weight=&quot;0.5&quot;
              android:layout_height=&quot;match_parent&quot;
              android:gravity=&quot;center&quot;
              android:textColor=&quot;#000&quot;
              android:id=&quot;@+id/textView37&quot; /&gt;
      &lt;/LinearLayout&gt;
      &lt;LinearLayout
          android:orientation=&quot;horizontal&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;40dp&quot;
          android:layout_below=&quot;@+id/lll&quot;
          android:layout_alignParentLeft=&quot;true&quot;
          android:layout_alignParentStart=&quot;true&quot;
          android:weightSum=&quot;1&quot;&gt;
          &lt;TextView
              android:layout_marginTop=&quot;-0.5dip&quot;
              android:textSize=&quot;16sp&quot;
              android:background=&quot;@drawable/fortablein&quot;
              android:gravity=&quot;center&quot;
              android:textColor=&quot;#000&quot;
              android:layout_width=&quot;0dp&quot;
              android:layout_weight=&quot;0.5&quot;
              android:layout_height=&quot;match_parent&quot;
              android:text=&quot;Total Payment&quot;
              android:id=&quot;@+id/textView38&quot; /&gt;
          &lt;TextView
              android:layout_marginLeft=&quot;-0.5dip&quot;
              android:layout_marginTop=&quot;-0.5dip&quot;
              android:textSize=&quot;16sp&quot;
              android:background=&quot;@drawable/fortablein&quot;
              android:layout_width=&quot;0dp&quot;
              android:layout_weight=&quot;0.5&quot;
              android:layout_height=&quot;match_parent&quot;
              android:gravity=&quot;center&quot;
              android:textColor=&quot;#000&quot;
              android:id=&quot;@+id/textView39&quot; /&gt;
      &lt;/LinearLayout&gt;
  &lt;/RelativeLayout&gt;
  &lt;LinearLayout
      android:orientation=&quot;horizontal&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;45dp&quot;
      android:id=&quot;@+id/linear&quot;
      android:background=&quot;#3784ba&quot;
      android:layout_below=&quot;@+id/rl&quot;
      android:weightSum=&quot;1&quot;&gt;
      &lt;TextView
          android:textSize=&quot;16sp&quot;
          android:layout_width=&quot;0dp&quot;
          android:layout_weight=&quot;0.25&quot;
          android:layout_height=&quot;match_parent&quot;
          android:gravity=&quot;center&quot;
          android:textColor=&quot;#fff&quot;
          android:text=&quot;Month&quot;
          android:id=&quot;@+id/textView212&quot; /&gt;
      &lt;TextView
          android:textSize=&quot;16sp&quot;
          android:layout_width=&quot;0dp&quot;
          android:layout_weight=&quot;0.25&quot;
          android:layout_height=&quot;match_parent&quot;
          android:gravity=&quot;center&quot;
          android:textColor=&quot;#fff&quot;
        android:text=&quot;Principal&quot;
          android:id=&quot;@+id/textView222&quot; /&gt;
      &lt;TextView
          android:textSize=&quot;16sp&quot;
          android:layout_width=&quot;0dp&quot;
          android:layout_weight=&quot;0.25&quot;
          android:layout_height=&quot;match_parent&quot;
          android:gravity=&quot;center&quot;
          android:textColor=&quot;#fff&quot;
         android:text=&quot;Interest&quot;
          android:id=&quot;@+id/textView232&quot; /&gt;
      &lt;TextView
          android:textSize=&quot;16sp&quot;
          android:layout_width=&quot;0dp&quot;
          android:layout_weight=&quot;0.25&quot;
          android:layout_height=&quot;match_parent&quot;
          android:gravity=&quot;center&quot;
          android:textColor=&quot;#fff&quot;
          android:text=&quot;Balance&quot;
          android:id=&quot;@+id/textView242&quot; /&gt;
  &lt;/LinearLayout&gt;
  &lt;ListView
      android:scrollbars=&quot;none&quot;
      android:nestedScrollingEnabled=&quot;false&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:id=&quot;@+id/listView2&quot;
      android:layout_below=&quot;@+id/linear&quot; /&gt;
  &lt;/RelativeLayout&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  <blockquote>
  <p>Here, the textviews used inside those layouts are not visible when i am running it. Is there a problem with my code? Guide me please.</p>
  <p>Thanks!</p>
  </blockquote>