Guest User

Untitled

a guest
Oct 20th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. <TextView
  2. android:id="@+id/user_text"
  3. android:layout_width="wrap_content"
  4. android:layout_height="wrap_content"
  5. android:layout_centerInParent="true"
  6. android:textColor="@android:color/black"
  7. android:textSize="18sp"
  8. android:elevation="20dp"
  9. android:paddingBottom="120dp" />
  10. . <--- that is supposed to represent that there's other non-relevant code in between
  11. .
  12. .
  13.  
  14. <RelativeLayout
  15. android:id="@+id/move_Group"
  16. android:layout_width="wrap_content"
  17. android:layout_height="wrap_content"
  18. android:layout_alignParentBottom="true"
  19. android:layout_marginBottom="5dp"
  20. android:layout_centerInParent="true"
  21. android:visibility="visible"
  22. android:gravity="center">
  23.  
  24. <Button
  25. android:id="@+id/move_left"
  26. android:layout_width="50dp"
  27. android:layout_height="wrap_content"
  28. android:background="@mipmap/arrow"
  29. android:rotation="-90"
  30. android:layout_marginRight="20dp"
  31. android:onClick="moveLeft"/>
  32.  
  33. <Button
  34. android:id="@+id/move_up"
  35. android:layout_width="50dp"
  36. android:layout_height="wrap_content"
  37. android:layout_toRightOf="@id/move_left"
  38. android:background="@mipmap/arrow"
  39. android:layout_marginRight="20dp"
  40. android:onClick="moveUp"/>
  41.  
  42. <Button
  43. android:id="@+id/move_down"
  44. android:layout_width="50dp"
  45. android:layout_height="wrap_content"
  46. android:layout_toRightOf="@id/move_up"
  47. android:background="@mipmap/arrow"
  48. android:rotation="180"
  49. android:layout_marginRight="20dp"
  50. android:onClick="moveDown"/>
  51.  
  52. <Button
  53. android:id="@+id/move_right"
  54. android:layout_width="50dp"
  55. android:layout_height="wrap_content"
  56. android:layout_toRightOf="@id/move_down"
  57. android:background="@mipmap/arrow"
  58. android:rotation="90"
  59. android:layout_marginRight="20dp"
  60. android:onClick="moveRight"/>
  61.  
  62. <TextView
  63. android:id="@+id/move"
  64. android:layout_width="wrap_content"
  65. android:layout_height="wrap_content"
  66. android:text="MOVE"
  67. android:textSize="20sp"
  68. android:layout_toRightOf="@id/move_right"
  69. android:textColor="@android:color/black"/>
  70.  
  71. </RelativeLayout>
  72.  
  73. TextView user_text = (TextView) findViewById(R.id.user_text);
  74. .
  75. .
  76. .
  77. public void moveLeft(View view)
  78. {
  79. user_text.setX(userX + 10);
  80. }
  81.  
  82. public void moveUp(View view)
  83. {
  84. user_text.setY(userY + 10);
  85. }
  86.  
  87. public void moveDown(View view)
  88. {
  89. user_text.setY(userY - 10);
  90. }
  91.  
  92. public void moveRight(View view)
  93. {
  94. user_text.setX(userX - 10);
  95. }
Add Comment
Please, Sign In to add comment