title: android Layout_gravity (not gravity) and Layout_marginTop(not marginTop) programmatically
body: <p>I need to programmatically create a Toast that use an ImageView and a TextView, and that appears in the middle of the screen, and I have done it.</p>
  
  <p><strong>THIS IS THE RENDER I WANT</strong>  </p>
  
  <p><img src="https://i.stack.imgur.com/0iZLO.png" alt="enter image description here"></p>
  
  <p>(The black square with the heart is the ImageView image, and the "J'aime" is the TextView)</p>
  
  <p><strong>XML Code :</strong> </p>
  
  <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content" &gt;
  
  &lt;ImageView
      android:id="@+id/toastImage"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginRight="1dp"
      android:src="@drawable/like" /&gt;
  
  &lt;TextView
      android:id="@+id/toastText"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center_horizontal"
      android:layout_marginTop="85dp"
      android:text="J'aime !"
      android:textColor="#FFFFFF" /&gt;
  
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p><strong>THIS IS THE RENDER I HAVE</strong> with JAVA code : </p>
  
  <p><img src="https://i.stack.imgur.com/kr3So.png" alt="enter image description here"></p>
  
  <p><strong>JAVA CODE :</strong> </p>
  
  <pre><code>FrameLayout toastLayout = new FrameLayout(this);
  LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
  toastLayout.setLayoutParams(llp);
  
   ImageView toastImg = new ImageView(this);
   Bitmap toastBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.like);
   toastImg.setImageBitmap(toastBitmap);
  
   TextView toastText = new TextView(this);
   toastText.setText("J'aime !");
  
   LinearLayout.LayoutParams toastTextLp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL);
   toastTextLp.setMargins(0, 85, 0, 0);
   toastText.setLayoutParams(toastTextLp);
  
   toastLayout.addView(toastImg);
   toastLayout.addView(toastText);
  
   Toast toast = new Toast(this);
   toast.setView(toastLayout);
  </code></pre>
  
  <p>I have tried with a relativelayout or a linearlayout, but the framelayout works better for this. 
  So I have a question :</p>
  
  <p>What is the JAVA equivalent of : </p>
  
  <pre><code>    android:layout_gravity="center_horizontal"
      android:layout_marginTop="85dp" 
  </code></pre>
  
  <p>? Because this is visibly not : </p>
  
  <pre><code>    LinearLayout.LayoutParams toastTextLp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL);
      toastTextLp.setMargins(0, 85, 0, 0);
  </code></pre>
  
  <p>Need help.</p>