https://kotlinlang.org logo
#compose
Title
# compose
k

Kort

03/26/2023, 8:59 AM
Hello everyone, I have encountered the same issue as this developer. In my design, I need the width of the ExposedDropdownMenu to be the same as the TextField, but since ExposedDropdownMenu does not have a place to set PopupProperties, its maximum width is limited. Do you have any suggestions on how to solve this issue? Thank you.
My final solution was to copy the entire source code of ExposedDropdownMenuPopup, and in the createLayoutParams function, change the width from WindowManager.LayoutParams.WRAP_CONTENT to MATCH_PARENT, and add horizontal padding myself to solve the problem. I am sharing this solution for those who need it.
I copied the
androidx.compose.material3.internal.ExposedDropdownMenuPopup
and some related components to my own project, and changed the
width
from
WindowManager.LayoutParams.WRAP_CONTENT
to
MATCH_PARENT
on line 448. Then, you can just use
fillMaxWidth
for your desired popup content. I hope this solution will also help you solve the problem.
thank you color 1
7 Views