在Android中创建自定义布局
我是android新手,我希望我的弹跳球游戏有如下布局(见下图)。请告诉我使用哪种布局在Android中创建自定义布局,android,android-layout,Android,Android Layout,我是android新手,我希望我的弹跳球游戏有如下布局(见下图)。请告诉我使用哪种布局 我将使用垂直线性布局,将其拆分为两部分 大概是这样的: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layou
我将使用垂直线性布局,将其拆分为两部分 大概是这样的:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:orientation="vertical" >
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="PlayingArea" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:orientation="horizontal" >
<Button
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="left_lower_box" />
<Button
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="right_lower_box" />
</LinearLayout>
</LinearLayout>
这只是一个样本;您可能不会在应用程序中使用按钮,您需要设置高度和宽度。我建议您使用方向垂直的线性布局,该布局分为两部分,一部分用于球反弹,另一部分用于设计得分布局。 分数布局可以再次设计为具有方向水平的线性布局