title: Switch right of TextInputLayout Android
body: <p>I would like to place a Switch right of a TextInputLayout, with match_parent parameters on the TextInput and a margin. </p>
  
  <p>Placing the switch to the left seems to work, however it is hidden when placing it to the right.</p>
  
  <p>See the two images below:</p>
  
  <p><a href="https://i.stack.imgur.com/gOkWj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gOkWj.png" alt="Switch to the left"></a></p>
  
  <p><a href="https://i.stack.imgur.com/7tixK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7tixK.png" alt="Switch to the right"></a></p>
  
  <p>As you can see the switch places itself wrongly.</p>
  
  <p>Here is my XML code. The main layout is a CoordinatorLayout:</p>
  
  <pre><code>                    &lt;LinearLayout
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:orientation="vertical"&gt;
  
                      &lt;TextView
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:text="Social Networks"
                          android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
                          android:textColor="@color/colorPrimary"
                          android:textStyle="bold" /&gt;
  
                      &lt;LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"&gt;
  
                          &lt;android.support.design.widget.TextInputLayout
                              style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              android:layout_marginEnd="40dp"&gt;
  
                              &lt;android.support.design.widget.TextInputEditText
                                  android:id="@+id/myprofile_google"
                                  android:inputType="textEmailAddress"
                                  android:layout_width="match_parent"
                                  android:textColor="@color/blue_grey_800"
                                  android:layout_height="wrap_content"
                                  android:hint="Google +" /&gt;
  
                          &lt;/android.support.design.widget.TextInputLayout&gt;
  
                          &lt;Switch
                              android:layout_width="wrap_content"
                              android:layout_height="30dp"
                              android:layout_gravity="center_vertical"/&gt;
  
  
  
                      &lt;/LinearLayout&gt;
  
                  &lt;/LinearLayout&gt;
  
              &lt;/LinearLayout&gt;
  </code></pre>