title: How to switch between 2 TextViews places on the layout?
body: <p>I have an <code>OnClickListener</code> that listens to <code>Button A</code> clicks. I also have 2 <code>TextViews</code> below the <code>Button</code>.</p>
  
  <p>I want that on every click on <code>Button A</code>, the 2 <code>TextViews</code> will switch their places between them, like this:</p>
  
  <p>Before clicking:</p>
  
  <pre><code>TextView A
  TextView B
  </code></pre>
  
  <p>After clicking:</p>
  
  <pre><code>TextView B
  TextView A
  </code></pre>
  
  <p>How can I do it? Is there a special function that meant to do that? or some kind of a trick? Thanks!</p>
  
  <p>actvity_main.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:gravity="start"
      tools:context="com.intap.tof.MainActivity"&gt;
  
      &lt;TextView
          android:id="@+id/txtA"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentStart="true"
          android:layout_alignParentLeft="true"
          android:layout_centerVertical="true"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:textSize="20dp"
          android:visibility="visible"/&gt;
  
      &lt;TextView
          android:id="@+id/txtB"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentStart="true"
          android:layout_alignParentLeft="true"
          android:layout_below="@+id/txtA
          android:layout_marginTop="83dp"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:visibility="visible"
          android:textSize="20dp" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>MainActivity.java:</p>
  
  <pre><code>txtA = (TextView) findViewById(R.id.txtA);
  txtB = (TextView) findViewById(R.id.txtB);
  
  float mAX = txtA.getX();
  float mAY = txtA.getY();
  float mBX = txtB.getX();
  float mBY= txtB.getY();
  
  txtA.setX(mBX);
  txtA.setY(mBY);
  
  txtB.setX(mAX);
  txtB.setY(mAY);
  </code></pre>