Android 我怎么把这个按钮放在我的两个号码牌下面?

Android 我怎么把这个按钮放在我的两个号码牌下面?,android,xml,button,layout,numberpicker,Android,Xml,Button,Layout,Numberpicker,现在我有两个数字图标和一个开始按钮,我的XML设置如下: <RelativeLayout 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" tools:context="com.skyt

现在我有两个数字图标和一个开始按钮,我的XML设置如下:

<RelativeLayout 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"
tools:context="com.skytbest.intervaltrainer.MainActivity">
<TextView
    android:id="@+id/timer"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentTop="true"
    android:text="Label"
    android:paddingBottom="50dp"
    android:paddingTop="50dp"
    android:textSize="50dp"
    />


<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_below="@id/timer">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/numberPickers">

        <NumberPicker
            android:id="@+id/numberPicker1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            />

        <NumberPicker
            android:id="@+id/numberPicker2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            />
    </LinearLayout>
    <Button
        android:id="@+id/button"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/start"
        android:layout_below="@id/numberPickers"
    />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:id="@+id/textView"
        android:text="@string/colon" />
</RelativeLayout>

看起来是这样的:

<RelativeLayout 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"
tools:context="com.skytbest.intervaltrainer.MainActivity">
<TextView
    android:id="@+id/timer"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentTop="true"
    android:text="Label"
    android:paddingBottom="50dp"
    android:paddingTop="50dp"
    android:textSize="50dp"
    />


<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_below="@id/timer">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/numberPickers">

        <NumberPicker
            android:id="@+id/numberPicker1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            />

        <NumberPicker
            android:id="@+id/numberPicker2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            />
    </LinearLayout>
    <Button
        android:id="@+id/button"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/start"
        android:layout_below="@id/numberPickers"
    />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:id="@+id/textView"
        android:text="@string/colon" />
</RelativeLayout>

如何让我的开始按钮直接位于两个数字图标下方,并跨越数字图标的宽度


如果你想知道TextView是一个“:”你现在看不到,因为按钮偏移了我的NumberPickers,但它的布局不同,因此它可以在NumberPickers上分层,而不会将它们分开。它居中时看起来像一个时钟

我将首先将根布局设置为
相对布局
,然后使用下面的
android:layout_
作为
按钮
。像这样的事情应该能让你接近

<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@id/timer">

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/ll">

    <NumberPicker
        android:id="@+id/numberPicker1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        />

    <NumberPicker
        android:id="@+id/numberPicker2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        />
</LinearLayout>
<Button
        android:id="@+id/button"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/start"
        android:layout_below="@id/ll" // id of your LinearLayout
        />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:id="@+id/textView"
    android:text=":" />
</RelativeLayout>


它不确定你想把你的
TextView
放在哪里,所以我把它放在一边。

我真的希望整个“计时器”模块有自己的布局,这样它就可以移动,最终打包成自己的东西,而不必成为它所在的更大应用程序的一部分。如果是这样的话,还有更好的方法吗?我发布了我的整个XML文件,timer TextView不会成为timer模块的一部分(我可能应该去掉它)。按照我展示的做,告诉我它有什么问题,我们将从那里开始。把你不想要的东西拿出来。你弄糊涂了。好吧,我用了你的代码,这就是目前的情况。我为你的混淆道歉。我希望它是两个数字图标,在屏幕中央,下面有开始按钮(跨越两个数字图标的宽度)。我认为最容易混淆的部分是冒号,因为我真的希望冒号位于两个数字选择器的“上方”,这样就不会将它们分开,并在它们之间创建一个空间。