I want that my TextInputLayout
has following functions:
- open a dialog on click
- show a ripple background like e.g. the
ExposedDropdownMenu
style does
It should look like a TextInputLayout
but work like a Button
.
Code
What I have so far is following:
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tilPlannedStartTime"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/planned_start_time"
android:padding="8dp">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tielPlannedStartTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:editable="false"
android:clickable="true"
android:focusable="false"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
And following:
binding.actvPlannedStartTime.setText(workout.item.plannedStartTime?.toString(SimpleTime.Format.DisplayHM) ?: "-")
binding.tielPlannedStartTime.setOnClickListener {
Toast.makeText(it.context, "TIEL", Toast.LENGTH_SHORT).show()
}
binding.tilPlannedStartTime.setOnClickListener {
Toast.makeText(it.context, "TIL", Toast.LENGTH_SHORT).show()
}
Problem
The click event does not have any visual feedback (ripple) like e.g. the ExposedDropdownMenu
style would have. Any ideas how to solve this better?