| <!-- Copyright 2025 The Android Open Source Project |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| xmlns:tools="http://schemas.android.com/tools" |
| android:id="@+id/root_layout" |
| android:layout_width="match_parent" |
| android:layout_height="match_parent" |
| android:paddingBottom="@dimen/activity_vertical_margin" |
| android:paddingLeft="@dimen/activity_horizontal_margin" |
| android:paddingRight="@dimen/activity_horizontal_margin" |
| android:paddingTop="@dimen/activity_vertical_margin" |
| tools:context="test.virtualgamepaddemo.MainActivity"> |
| |
| <!-- Joysticks at the bottom --> |
| <Button |
| android:id="@+id/xy_circular_button" |
| android:layout_width="200dp" |
| android:layout_height="200dp" |
| android:background="@drawable/circular_button_background" |
| android:text="left stick" |
| android:textColor="@android:color/black" |
| android:layout_alignParentStart="true" |
| android:layout_alignParentBottom="true" /> |
| |
| <Button |
| android:id="@+id/zrz_circular_button" |
| android:layout_width="200dp" |
| android:layout_height="200dp" |
| android:background="@drawable/circular_button_background" |
| android:text="right stick" |
| android:textColor="@android:color/black" |
| android:layout_alignParentEnd="true" |
| android:layout_alignParentBottom="true" /> |
| |
| <!-- Top Left Buttons --> |
| <Button |
| android:id="@+id/button_l1" |
| android:layout_width="wrap_content" |
| android:layout_height="wrap_content" |
| android:text="L1" |
| android:layout_alignParentTop="true" |
| android:layout_alignParentStart="true"/> |
| |
| <Button |
| android:id="@+id/button_l2" |
| android:layout_width="wrap_content" |
| android:layout_height="wrap_content" |
| android:text="L2" |
| android:layout_below="@id/button_l1" |
| android:layout_alignParentStart="true"/> |
| |
| <GridLayout |
| android:id="@+id/dpad_layout" |
| android:layout_width="wrap_content" |
| android:layout_height="wrap_content" |
| android:columnCount="3" |
| android:rowCount="3" |
| android:layout_below="@id/button_l2" |
| android:layout_alignParentStart="true" |
| android:layout_marginTop="10dp"> |
| |
| <Space/> |
| <Button |
| android:id="@+id/dpad_up" |
| android:layout_width="50dp" |
| android:layout_height="50dp" |
| android:text="U"/> |
| <Space/> |
| |
| <Button |
| android:id="@+id/dpad_left" |
| android:layout_width="50dp" |
| android:layout_height="50dp" |
| android:text="L"/> |
| <Space/> |
| <Button |
| android:id="@+id/dpad_right" |
| android:layout_width="50dp" |
| android:layout_height="50dp" |
| android:text="R"/> |
| |
| <Space/> |
| <Button |
| android:id="@+id/dpad_down" |
| android:layout_width="50dp" |
| android:layout_height="50dp" |
| android:text="D"/> |
| <Space/> |
| </GridLayout> |
| |
| <!-- Top Right Buttons --> |
| <Button |
| android:id="@+id/button_r1" |
| android:layout_width="wrap_content" |
| android:layout_height="wrap_content" |
| android:text="R1" |
| android:layout_alignParentTop="true" |
| android:layout_alignParentEnd="true"/> |
| |
| <Button |
| android:id="@+id/button_r2" |
| android:layout_width="wrap_content" |
| android:layout_height="wrap_content" |
| android:text="R2" |
| android:layout_below="@id/button_r1" |
| android:layout_alignParentEnd="true"/> |
| |
| <GridLayout |
| android:id="@+id/abxy_layout" |
| android:layout_width="wrap_content" |
| android:layout_height="wrap_content" |
| android:columnCount="2" |
| android:rowCount="2" |
| android:layout_below="@id/button_r2" |
| android:layout_alignParentEnd="true" |
| android:layout_marginTop="10dp"> |
| |
| <Button |
| android:id="@+id/button_y" |
| android:layout_width="wrap_content" |
| android:layout_height="wrap_content" |
| android:text="Y"/> |
| <Button |
| android:id="@+id/button_x" |
| android:layout_width="wrap_content" |
| android:layout_height="wrap_content" |
| android:text="X"/> |
| <Button |
| android:id="@+id/button_b" |
| android:layout_width="wrap_content" |
| android:layout_height="wrap_content" |
| android:text="B"/> |
| <Button |
| android:id="@+id/button_a" |
| android:layout_width="wrap_content" |
| android:layout_height="wrap_content" |
| android:text="A"/> |
| </GridLayout> |
| |
| |
| <!-- Top Center Buttons --> |
| <Button |
| android:id="@+id/button_select" |
| android:layout_width="wrap_content" |
| android:layout_height="wrap_content" |
| android:text="Select" |
| android:layout_alignParentTop="true" |
| android:layout_toStartOf="@+id/button_start" |
| android:layout_marginEnd="10dp"/> |
| |
| <Button |
| android:id="@+id/button_start" |
| android:layout_width="wrap_content" |
| android:layout_height="wrap_content" |
| android:text="Start" |
| android:layout_alignParentTop="true" |
| android:layout_centerHorizontal="true"/> |
| |
| </RelativeLayout> |