0

画面の両側からアプリの中央まで (わずかなマージンで) 2 つのボタンを配置したいと考えています。

そう願っていた

android:layout_alignParentLeft="true" 

入力した場合も同じように機能します

android:layout_alignParentcenter="true"

しかし、それは同じようには機能しません。

ここに私のXMLがあります

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    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=".MainActivity" >

    <Button
        android:id="@+id/cath"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/cmhs"
        android:layout_alignBottom="@+id/cmhs"
        android:layout_alignLeft="@+id/mhsdir"
        android:layout_alignParentRight="true"
        android:background="@drawable/button_custom"
        android:text="@string/cath"
        android:textColor="#000000" />

    <Button
        android:id="@+id/cfeel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/sclose"
        android:layout_alignLeft="@+id/cath"
        android:layout_alignRight="@+id/cath"
        android:background="@drawable/button_custom"
        android:text="@string/cfeel"
        android:textColor="#000000" />

    <Button
        android:id="@+id/mhshome"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textView1"
        android:layout_toRightOf="@+id/textView2"
        android:background="@drawable/button_custom"
        android:onClick="onClick"
        android:text="@string/mhsdir"
        android:layout_marginTop="15dp"
        android:textColor="#000000" />

    <Button
        android:id="@+id/mhsdir"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/mhshome"
        android:layout_alignParentRight="true"
        android:layout_alignTop="@+id/pp"
        android:background="@drawable/button_custom"
        android:text="@string/webclo"
        android:textColor="#000000" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:text="@string/weblink"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <Button
        android:id="@+id/webclo"
        style="@style/AppBaseTheme"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/pp"
        android:layout_alignRight="@+id/cmhs"
        android:layout_below="@+id/textView1"
        android:background="@drawable/button_custom"
        android:text="@string/mhshome"
        android:layout_marginTop="15dp"
        android:textColor="#000000" />

    <Button
        android:id="@+id/pp"
        style="@style/AppBaseTheme"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/cmhs"
        android:layout_alignRight="@+id/cmhs"
        android:layout_below="@+id/webclo"
        android:layout_marginTop="20dp"
        android:background="@drawable/button_custom"
        android:text="@string/pp"
        android:textColor="#000000" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/mhsdir"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="10dp"
        android:text="@string/phonenum"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <Button
        android:id="@+id/cmhs"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/sclose"
        android:layout_alignRight="@+id/sclose"
        android:layout_below="@+id/textView2"
        android:background="@drawable/button_custom"
        android:text="@string/callmhs"
        android:textColor="#000000" />

    <Button
        android:id="@+id/sclose"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/cmhs"
        android:layout_marginTop="20dp"
        android:background="@drawable/button_custom"
        android:text="@string/sclose"
        android:textColor="#000000" />

    <Button
        android:id="@+id/school"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/ath"
        android:layout_alignBottom="@+id/ath"
        android:layout_alignLeft="@+id/cfeel"
        android:layout_alignRight="@+id/cfeel"
        android:background="@drawable/button_custom"
        android:text="@string/school"
        android:textColor="#000000" />

    <Button
        android:id="@+id/ath"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/sclose"
        android:layout_alignParentBottom="true"
        android:layout_alignRight="@+id/sclose"
        android:layout_marginBottom="10dp"
        android:background="@drawable/button_custom"
        android:text="@string/ath"
        android:textColor="#000000" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/school"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="15dp"
        android:text="@string/cal"
        android:textAppearance="?android:attr/textAppearanceLarge" />

</RelativeLayout>

写真を添付し​​たいのですが、十分な担当者がいません...

4

1 に答える 1