6つのNumberPickerと2つのボタンを含むポップアップダイアログを作成しようとしています。以下は XMLコードです:私の問題は、(それが実際に画面に表示されdoesntの)赤にここに見られるように、最後のNumberPickerは、ダイアログのエッジ消灯ということです 私が使用Androidのダイアログの内容が一致しません
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/np"
android:layout_centerHorizontal="true">
<NumberPicker
android:id="@+id/numberPicker1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:descendantFocusability="blocksDescendants"/>
<NumberPicker
android:id="@+id/numberPicker2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:descendantFocusability="blocksDescendants"/>
<NumberPicker
android:id="@+id/numberPicker3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:descendantFocusability="blocksDescendants"/>
<NumberPicker
android:id="@+id/numberPicker4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:descendantFocusability="blocksDescendants"/>
<NumberPicker
android:id="@+id/numberPicker5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:descendantFocusability="blocksDescendants"/>
<NumberPicker
android:id="@+id/numberPicker6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:descendantFocusability="blocksDescendants"/>
</LinearLayout>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Set"
android:layout_below="@+id/np"
android:layout_alignParentEnd="true" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:layout_below="@+id/np"
android:layout_alignParentStart="true" />
</RelativeLayout>
とコードで単純に:
final Dialog dialog = new Dialog(EditTextActivity.this);
dialog.setContentView(R.layout.registration_picker_dialog);
dialog.setTitle("Edit Year");
NumberPickersの幅を縮小するためにXMLには何かがありますか?
「NumberPicker」ごとに、「layout_width」を「0dp」に、「layout_weight」を「1」に設定します。 –