一个以前用过的类型的游戏手柄
直接代码
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context=".MainActivity" >
<RelativeLayout
android:id="@+id/zuo"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
>
<Button
android:id="@+id/zhong"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="中"
/>
<Button
android:id="@+id/shang"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_above="@id/zhong"
android:text="上"
/>
<Button
android:id="@+id/xia"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/zhong"
android:layout_centerHorizontal="true"
android:text="下"
/>
<Button
android:id="@+id/zuo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/zhong"
android:layout_centerVertical="true"
android:text="左"
/>
<Button
android:id="@+id/you"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/zhong"
android:layout_centerVertical="true"
android:text="右"
/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/you"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
>
<Button
android:id="@+id/a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:text="A"
/>
<Button
android:id="@+id/b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/a"
android:text="B"
/>
</RelativeLayout>
</LinearLayout>