/ /相対的なレイアウトで要素を配置する方法[クローズド] - android

相対レイアウトで要素を配置する方法[閉じる] - アンドロイド

私は相対レイアウトでデザインを持っています中心的な要素。その中心的な要素の左側にある別の要素と、これら両方の基底が同じレベルになるようにします。 alignBaselineを試しましたが、役に立ちません。

助けてください ... !!!

回答:

回答№1は1

これは私のために働く。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ff0" >

<Button
android:id="@+id/first"
android:layout_width="50dip"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginTop="5dip" />

<Button
android:id="@+id/second"
android:layout_width="50dip"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/first"
android:layout_alignBottom="@+id/first"
android:layout_toRightOf="@+id/first" />

</RelativeLayout>

回答№2の場合は0

RelativeLayoutの属性を使用する必要があります。 ここに 指示といくつかの例については。

しかし、要約するとあなたは必要です:

android:layout_toLeftOf="@+id/center_element"

android:layout_alignBottom="@+id/center_element"