title: How to customize full toast size in android
body: <p>I am showing a customized toast, with a background image of some creature, but i want the toast to be of my  defined size.</p>
  
  <p>It was not possible in normal toast by using this:</p>
  
  <pre><code>View view = toast.getView();
  view.setBackgroundResource(R.drawable.go);
  toast.setView(view);`
  </code></pre>
  
  <p>Then i used layout inflater like this:</p>
  
  <pre><code>LayoutInflater inflater = getLayoutInflater();
  View layout = inflater.inflate(R.layout.hit_toast,
                                      (ViewGroup) findViewById(R.id.custom_toast_layout));
       layout.setBackgroundResource(R.drawable.go);
       TextView text = (TextView) layout.findViewById(R.id.textToShow);
       // Set the Text to show in TextView
       text.setText(msg);
  
       Toast toast = new Toast(getApplicationContext());
       //toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
       toast.setDuration(Toast.LENGTH_SHORT);
       toast.setView(layout);
       toast.show();
  </code></pre>
  
  <p>and my xml: </p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/custom_toast_layout"
      android:layout_width="100dp"
      android:layout_height="100dp"
      android:layout_gravity="center"
      android:background="#DAAA"
      android:gravity="center"
      android:orientation="horizontal"
      android:padding="8dp" &gt;
  
      &lt;TextView
          android:id="@+id/textToShow"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center"
          android:text="ll"
          android:textColor="#00ffff" /&gt;
  &lt;/LinearLayout&gt;`
  </code></pre>
  
  <p>But still the size of toast is same just position is changed. </p>