title: How to programmatically add 2 textview in a linear layout
body: <p><img src="https://i.stack.imgur.com/CXyw4.jpg" alt="enter image description here"></p>
  
  <p>Hi everyone,</p>
  
  <p>I am getting the following fields "Name" and "Skoda" from API. There will be x number of items like this. As per design, i should show them as like in the following image.</p>
  
  <p>So, I decided to create  two textview programmatically in a linear layout named  "childLayout" like the following.</p>
  
  <pre><code>-- RelativeLayout
  
    -- Linear Layout
          -- TextView  Textview --
    -- Linear Layout 
  
    -- Linear Layout
          -- TextView  Textview --
    -- Linear Layout      
  
    -- Linear Layout
          -- TextView  Textview --
    -- Linear Layout 
  
  --RelativeLayout
  </code></pre>
  
  <p>But i am not getting the desired output. Please help me to fix this issue. </p>
  
  <p>Here is code :</p>
  
  <pre><code>TextView mType;
  TextView mValue;        
  for (int i = 0; i &lt; getDetailedDescAL.size(); i++) {
  
      LinearLayout childLayout = new LinearLayout(
              DetailedCategories.this);
  
      LinearLayout.LayoutParams linearParams = new LinearLayout.LayoutParams(
              LayoutParams.WRAP_CONTENT,
              LayoutParams.WRAP_CONTENT);
      childLayout.setLayoutParams(linearParams);
  
      mType = new TextView(DetailedCategories.this);
      mValue = new TextView(DetailedCategories.this);
  
      mType.setLayoutParams(new TableLayout.LayoutParams(
              LayoutParams.WRAP_CONTENT,
              LayoutParams.WRAP_CONTENT, 1f));
      mValue.setLayoutParams(new TableLayout.LayoutParams(
              LayoutParams.WRAP_CONTENT,
              LayoutParams.WRAP_CONTENT, 1f));
  
      mType.setTextSize(17);
      mType.setPadding(5, 3, 0, 3);
      mType.setTypeface(Typeface.DEFAULT_BOLD);
      mType.setGravity(Gravity.LEFT | Gravity.CENTER);
  
      mValue.setTextSize(16);
      mValue.setPadding(5, 3, 0, 3);
      mValue.setTypeface(null, Typeface.ITALIC);
      mValue.setGravity(Gravity.LEFT | Gravity.CENTER);
  
      mType.setText(getDetailedDescAL.get(i).getmPropertyType());
      mValue.setText(getDetailedDescAL.get(i).getmPropertyValue());
  
      childLayout.addView(mValue, 0);
      childLayout.addView(mType, 0);
  
      RelativeLayout.LayoutParams relativeParams = 
          new RelativeLayout.LayoutParams(
              LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
      relativeParams.addRule(RelativeLayout.BELOW);
      Details.addView(childLayout, relativeParams);
  
      // Details is the relative layout declared in XML
  
  }
  </code></pre>
  
  <p>The output is :</p>
  
  <p><img src="https://i.stack.imgur.com/VOMA6.png" alt="enter image description here"></p>
  
  <p>It seems like the textviews are overriding. How to solve this.</p>