title: How to make Button square and resizable
body: <p>I would like to make button (the one between two other buttons) Square. </p>
  
  <p><img src="https://i.stack.imgur.com/TpxrM.png" alt="enter image description here"></p>
  
  <p>I tried to use following code:</p>
  
  <pre><code>toggleButton = (ToggleButton) findViewById(R.id.activity_dictionary_toggleButton1);
  LinearLayout.LayoutParams toggleButtonLayoutParams = (LayoutParams) toggleButton.getLayoutParams(); 
  toggleButtonLayoutParams.width = toggleButtonLayoutParams.height;
  toggleButton.setLayoutParams(toggleButtonLayoutParams);
  </code></pre>
  
  <p>But it is not working (Button look like on the above image). Here is part of my XML file:</p>
  
  <pre><code>&lt;LinearLayout
      android:id="@+id/activity_dictionary_linearLayout2"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentBottom="true"
      android:layout_marginTop="5dp" &gt;
  
      &lt;Button
          android:id="@+id/activity_dictionary_button1"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:layout_gravity="center_vertical|center_horizontal"
          android:layout_weight="0.4"
          android:enabled="false"
          android:maxWidth="200dp"
          android:text="Clear"
          android:textColor="@android:color/white" /&gt;
  
      &lt;ToggleButton
          android:id="@+id/activity_dictionary_toggleButton1"
          android:layout_width="20dp"
          android:layout_height="20dp"
          android:layout_gravity="center_vertical|center_horizontal"
          android:layout_weight="0.2"
          android:background="@drawable/settings"
          android:text="ToggleButton" /&gt;
  
      &lt;Button
          android:id="@+id/activity_dictionary_button2"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:layout_gravity="center_vertical|center_horizontal"
          android:layout_weight="0.4"
          android:enabled="false"
          android:maxWidth="200dp"
          android:text="Recognize"
          android:textColor="@android:color/white" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>What should I change?  </p>
  
  <p>Update: <code>android:layout_weight="0.2"</code> is deleted, but Button still doesn't change its size when I try to do it through code (it is round but very small).</p>