I'm developing an Android application that's basically a game. In one of the Activities there are a few buttons, and I wanted that when one event occurred (it could even be the trigger of another button) two buttons changed position in the layout. I searched the Transition class documentation to see if it was possible to use an animation to make this switch, but I really wanted something with a non-existent delay.
NOTE: Just changing the appearance of the buttons are not options for me, since each of these buttons have different functions within the application and I need to keep them.
<LinearLayout android:id="@+id/lytKeyboard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:orientation="vertical">
<LinearLayout android:id="@+id/lytKeyboardLine1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button android:id="@+id/btn1"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="1"
android:textSize="50sp"/>
<Button android:id="@+id/btn2"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="2"
android:textSize="50sp"/>
<Button android:id="@+id/btn3"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="3"
android:textSize="50sp"/>
</LinearLayout>
<LinearLayout android:id="@+id/lytKeyboardLine2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button android:id="@+id/btn4"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="4"
android:textSize="50sp"/>
<Button android:id="@+id/btn5"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="5"
android:textSize="50sp"/>
<Button android:id="@+id/btn6"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="6"
android:textSize="50sp"/>
</LinearLayout>
<LinearLayout android:id="@+id/lytKeyboardLine3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button android:id="@+id/btn7"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="7"
android:textSize="50sp"/>
<Button android:id="@+id/btn8"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="8"
android:textSize="50sp"/>
<Button android:id="@+id/btn9"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="9"
android:textSize="50sp"/>
</LinearLayout>
<Button android:id="@+id/btn0"
android:layout_width="match_parent"
android:layout_height="100dp"
android:text="0"
android:textSize="50sp"/>
</LinearLayout>