title: Android: TextView ignores Gravity and Margin
body: <p>Here is my code:</p>
  
  <pre><code> //define tablerows. each table row has max 3 buttons
   LinearLayout llRow1 = (LinearLayout)findViewById(R.id.llRow1); llRow1.removeAllViews();
  
     float scale = getResources().getDisplayMetrics().density;
     int padding_5dp = (int) (5 * scale + 0.5f);
  
  //Define FrameLayout
         FrameLayout flTmp = new FrameLayout(this);
         LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.FILL_PARENT, 1f);
         lp.setMargins(0, 0, padding_5dp, padding_5dp);
         flTmp.setLayoutParams(lp);
  
  //Add dynamically TextView
  TextView tvTmp = new TextView(this);
  tvTmp.setText("Test");
  LinearLayout.LayoutParams tvPara=new LinearLayout.LayoutParams(
                              LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT );
  tvPara.gravity = Gravity.BOTTOM | Gravity.LEFT;
  tvPara.setMargins(padding_5dp, 0, 0, 0);
  tvTmp.setLayoutParams(tvPara);
  
  //Add dynamically Buttons for juice
      ImageButton btnTmp = new ImageButton(this);
  
  [...]
  
  //Add Button and TextView to FrameLayout
      flTmp.addView(btnTmp);
      flTmp.addView(tvTmp);
  
  llRow1.addView(flTmp);
  </code></pre>
  
  <p>What i try to do is create an imagebutton dynamically with a textview description like following xml code:</p>
  
  <pre><code>&lt;FrameLayout&gt;
  &lt;ImageButton android:background="@null" android:id="@+id/button_x" android:layout_width="fill_parent" android:layout_height="fill_parent" android:scaleType="fitXY" android:src="@drawable/button_graphic"&gt;&lt;/ImageButton&gt;    
  &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:clickable="false" android:text="TEST TEST"&gt;&lt;/TextView&gt;
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>works fine with my code, but the textview ignores margin and gravity parameters.
  its located on upper left corner without margins.</p>
  
  <p>Any hint?</p>