Skip to content

Commit

Permalink
[DatePicker] Fix arrangement of range text fields
Browse files Browse the repository at this point in the history
- gives enough space for the text to not wrap when width too narrow

PiperOrigin-RevId: 632262914
  • Loading branch information
paulfthomas authored and dsn5ft committed May 13, 2024
1 parent b301a58 commit 501ae36
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/mtrl_picker_text_input_date"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:minWidth="@dimen/material_textinput_min_width_with_label"
android:maxWidth="@dimen/material_textinput_max_width"
android:layout_gravity="center_horizontal">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingTop="@dimen/mtrl_calendar_text_input_padding_top"
android:paddingBottom="16dp"
android:paddingLeft="@dimen/mtrl_calendar_content_padding"
android:paddingRight="@dimen/mtrl_calendar_content_padding"
android:orientation="horizontal">
android:orientation="vertical">

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/mtrl_picker_text_input_range_start"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
android:minWidth="@dimen/material_textinput_min_width_with_label"
android:maxWidth="@dimen/material_textinput_max_width"
android:layout_gravity="center_horizontal">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
Expand All @@ -41,14 +43,16 @@
</com.google.android.material.textfield.TextInputLayout>

<Space
android:layout_width="8dp"
android:layout_height="0dp"/>
android:layout_width="0dp"
android:layout_height="8dp"/>

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/mtrl_picker_text_input_range_end"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
android:minWidth="@dimen/material_textinput_min_width_with_label"
android:maxWidth="@dimen/material_textinput_max_width"
android:layout_gravity="center_horizontal">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<!-- Minimum width for text fields without a label. If a label is present,
minimum width should be 88dp. -->
<dimen name="material_textinput_min_width">56dp</dimen>
<dimen name="material_textinput_min_width_with_label">88dp</dimen>
<dimen name="material_textinput_max_width">488dp</dimen>

<dimen name="mtrl_textinput_outline_box_expanded_padding">16dp</dimen>
Expand Down

0 comments on commit 501ae36

Please sign in to comment.