Skip to content

Commit

Permalink
fixme Show notes: make text field use available space, grow as needed
Browse files Browse the repository at this point in the history
  • Loading branch information
UweTrottmann committed Nov 14, 2024
1 parent 5058ac0 commit 4f6978c
Showing 1 changed file with 27 additions and 31 deletions.
58 changes: 27 additions & 31 deletions app/src/main/res/layout/dialog_edit_note.xml
Original file line number Diff line number Diff line change
@@ -1,41 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/scrollViewEditNote"
android:id="@+id/rootLayoutEditNote"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="wrap_content"
android:orientation="vertical">

<androidx.constraintlayout.widget.ConstraintLayout
<!-- counterMaxLength set in code -->
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textFieldEditNote"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="@dimen/dialog_min_width"
android:orientation="vertical">
android:layout_height="0dp"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:layout_weight="1"
app:counterEnabled="true"
app:counterMaxLength="500"
app:endIconMode="clear_text">

<!-- counterMaxLength set in code -->
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textFieldEditNote"
android:layout_width="0dp"
<!-- FIXME This can grow taller than TextInputLayout has space available, so will push out the counter. -->
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
app:counterEnabled="true"
app:counterMaxLength="500"
app:endIconMode="clear_text"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
android:gravity="top"
android:inputType="textMultiLine"
tools:text="This is an example note.\nIt contains a line break. " />

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top"
android:inputType="textMultiLine"
android:lines="6"
tools:text="This is an example note.\nIt contains a line break. " />
</com.google.android.material.textfield.TextInputLayout>

</com.google.android.material.textfield.TextInputLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<androidx.constraintlayout.helper.widget.Flow
android:layout_width="0dp"
Expand All @@ -51,14 +47,14 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textFieldEditNote" />
app:layout_constraintTop_toTopOf="parent" />

<Button
android:id="@+id/buttonNegative"
style="?attr/buttonBarNegativeButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Button Negative With Long Text" />
tools:text="Button Negative With Very Very Long Text" />

<Button
android:id="@+id/buttonPositive"
Expand All @@ -69,4 +65,4 @@

</androidx.constraintlayout.widget.ConstraintLayout>

</ScrollView>
</LinearLayout>

0 comments on commit 4f6978c

Please sign in to comment.