title: Setting margin to TextView makes it disappear
body: <p>I'm a beginner in Android devt (started 3 days ago) and have a problem declaring a View's Layout. I have checked everywhere on how to set a TextView's margins programatically and so far, none of them work. The TextView always disappears when I apply the Layout.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>TableLayout tView = (TableLayout)findViewById(R.id.AllDocumentsTable);
  TableRow trView = buildRow();
  
  TextView tViewProjTitle = buildCell();
  tViewProjTitle.setText(doc.project);
  
  TextView tViewDocTitle = buildCell();
  tViewDocTitle.setText(doc.document);
  
  trView.addView(tViewProjTitle);
  trView.addView(tViewDocTitle);
  
  try {
        tView.addView(trView, i);
      }
  catch (Exception e) {
       Log.e("adding tablerow", e.getMessage());
      }
  </code></pre>
  
  <p>buildRow()..</p>
  
  <pre><code>    private TableRow buildRow(){
          TableRow retRow = new TableRow(this);
          retRow.setBackgroundColor(Color.WHITE);
          TableLayout.LayoutParams rowLayout = new    TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, 
                  TableLayout.LayoutParams.WRAP_CONTENT);
  
          rowLayout.setMargins(2, 2, 2, 2);
          retRow.setLayoutParams(rowLayout);
          return retRow;
  }
  </code></pre>
  
  <p>buildCell()..</p>
  
  <pre><code>private TextView buildCell(){
      TextView retTView = new TextView(this);
  
      retTView.setBackgroundColor(Color.WHITE);
      retTView.setGravity(0);
  
      LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, 
              LinearLayout.LayoutParams.WRAP_CONTENT);
      params.setMargins(2, 2, 2, 2);
  
      retTView.setLayoutParams(params);
      return retTView;
  }
  </code></pre>
  
  <p>My Activity's layout.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;  
  &lt;LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#ffffff"&gt; 
      &lt;HorizontalScrollView android:id="@+id/horizontalScrollView1" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt;
          &lt;LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#ffffff"&gt;   
              &lt;TableLayout android:layout_height="wrap_content" 
                  android:id="@+id/AllDocumentsTable" 
                  android:layout_width="match_parent" 
                  android:background="#ffffff"&gt;
                  &lt;TableRow android:layout_margin="2dp" 
                      android:background="#000000"&gt;
                      &lt;TextView android:text="Test Text1." android:layout_margin="2dp" android:background="#ffffff"&gt;&lt;/TextView&gt;
                      &lt;TextView android:text="Test Text2" android:layout_margin="2dp" android:background="#ffffff"&gt;&lt;/TextView&gt;
                  &lt;/TableRow&gt;
              &lt;/TableLayout&gt;      
          &lt;/LinearLayout&gt;
      &lt;/HorizontalScrollView&gt;    
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Help!!! :)</p>