Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <TextView
- android:id="@+id/user_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerInParent="true"
- android:textColor="@android:color/black"
- android:textSize="18sp"
- android:elevation="20dp"
- android:paddingBottom="120dp" />
- . <--- that is supposed to represent that there's other non-relevant code in between
- .
- .
- <RelativeLayout
- android:id="@+id/move_Group"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:layout_marginBottom="5dp"
- android:layout_centerInParent="true"
- android:visibility="visible"
- android:gravity="center">
- <Button
- android:id="@+id/move_left"
- android:layout_width="50dp"
- android:layout_height="wrap_content"
- android:background="@mipmap/arrow"
- android:rotation="-90"
- android:layout_marginRight="20dp"
- android:onClick="moveLeft"/>
- <Button
- android:id="@+id/move_up"
- android:layout_width="50dp"
- android:layout_height="wrap_content"
- android:layout_toRightOf="@id/move_left"
- android:background="@mipmap/arrow"
- android:layout_marginRight="20dp"
- android:onClick="moveUp"/>
- <Button
- android:id="@+id/move_down"
- android:layout_width="50dp"
- android:layout_height="wrap_content"
- android:layout_toRightOf="@id/move_up"
- android:background="@mipmap/arrow"
- android:rotation="180"
- android:layout_marginRight="20dp"
- android:onClick="moveDown"/>
- <Button
- android:id="@+id/move_right"
- android:layout_width="50dp"
- android:layout_height="wrap_content"
- android:layout_toRightOf="@id/move_down"
- android:background="@mipmap/arrow"
- android:rotation="90"
- android:layout_marginRight="20dp"
- android:onClick="moveRight"/>
- <TextView
- android:id="@+id/move"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="MOVE"
- android:textSize="20sp"
- android:layout_toRightOf="@id/move_right"
- android:textColor="@android:color/black"/>
- </RelativeLayout>
- TextView user_text = (TextView) findViewById(R.id.user_text);
- .
- .
- .
- public void moveLeft(View view)
- {
- user_text.setX(userX + 10);
- }
- public void moveUp(View view)
- {
- user_text.setY(userY + 10);
- }
- public void moveDown(View view)
- {
- user_text.setY(userY - 10);
- }
- public void moveRight(View view)
- {
- user_text.setX(userX - 10);
- }
Add Comment
Please, Sign In to add comment