title: Android: Adding view dynamically in a nested layout
body: <p>I have an abc.xml with the following structure.</p>
  
  <pre><code>&lt;ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"&gt;
   &lt;RelativeView
     android:layout_width="match_parent"
     android:layout_height="wrap_content"&gt;
    &lt;LinearLayout
      android:id="@+id/linear"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      &gt;
    &lt;/LinearLayout&gt;
   &lt;/RelativeLayout&gt;
  &lt;/ScrollView&gt;
  </code></pre>
  
  <p>I want to add textviews dynamically to linear layout. Below is my code. I don't get any errors but I am not getting the desired results.</p>
  
  <pre><code>LayoutInflater Inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          View view = Inflater.inflate(R.layout.abc, null);
  
  LinearLayout layout = (LinearLayout) view.findViewById(R.id.linear);
  
          TextView Tag = new TextView(getActivity());
          Tag.setText("textString");
          Tag.setBackgroundResource(R.color.bg_color);
          Tag.setTextAppearance(getActivity(), R.style.SmallFont);
          layout.addView(Tag);
  </code></pre>