ボタンのヘルプに10dpの左右に余白が付いています。その後、ボタンhelp
の下のTextView
(水平の中央)の左にボタンテストを追加し、ボタンhelp
の左に揃えます。アライメントに関するレイアウトの問題
問題は、ボタンのテストが正確にボタンhelp
の右側にTextView
test1
のようにボタンhelp
に整列されていないということです。
私は間違っていますか?私はthatsのヘルプボタンのちょうど背景を考える
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
>
<TextView
android:id="@+id/mid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="1"
android:gravity="center"
/>
<Button
android:id="@+id/help"
android:text="Help"
android:layout_width="match_parent"
android:layout_marginTop="35dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/test"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/help"
android:layout_marginTop="5dp"
android:background="#87CEFF"
android:text="Test"
android:layout_toLeftOf="@id/mid"
android:layout_alignLeft="@id/help"
/>
<TextView
android:id="@+id/test1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/mid"
android:layout_alignBottom="@id/test"
android:layout_alignTop="@id/test"
android:layout_alignRight="@id/help"
android:text="test1\ntest2"
android:gravity="center"
android:textColor="#0000ff"
android:background="#00cc00"
/>
</RelativeLayout>
を解決を願ってみてください。 ビューを表示するための期待値は –
です。レイアウトの出力を見ると、ボタンのテストはボタンのヘルプに(一部のピクセルによって)正確には整列していません。テキストビューtest1はヘルプの右側にはありません。 – narb
あなたの光はちょうどあなたに背景色を与える整列されていますヘルプボタン –