layout_widthをmatch_parentに配置したときに、datepickerとtimepickerを分割線の下で水平方向に中央に配置できない理由がわかりません。
分割線の layout_width を wrap_content にすると、ピッカーが水平方向に中央揃えになります。しかし、線は相対ビューを埋めません。
私はただ混乱しています、何が起こっているのか理解できません。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal" >
<!-- Dividing Line -->
<TextView
android:id="@+id/BlueLine"
android:layout_width="match_parent"
android:layout_height="2dip"
android:background="@color/holo_blue_light" />
<DatePicker
android:id="@+id/DatePicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/BlueLine"
android:layout_marginRight="40dp" />
<TimePicker
android:id="@+id/TimePicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/BlueLine"
android:layout_toRightOf="@+id/DatePicker" />
</RelativeLayout>