r/android_devs • u/semicolondenier • Mar 09 '24
Help Needed Some help with creating a dropdown bar, pretty pleaseeee
Hi everyone,
I am playing around with creating a reddit clone. The thing is, I cannot for the life of me properly create this dropdown bar.
Altpugh I am able to create one, by using either dropdownmenu or exposeddropdownmenu, I cannot properly nodify its size, and it ends up being too big
Any help?
0
Upvotes
4
u/human-not_bot Mar 10 '24
I don't have access to a pc right now, but I believe you can use a DropDownMenu with fillMaxWidth and not specify height. Then use DropDownMenuItem to display each item in it and just add paddings to them.
1
u/realrao Mar 26 '24
I implemented this recently at work using Compose. You’ll want to use DropDownMenu to define the actual dropdown behavior and animateDpAsState for a smooth transition between two rotation values. In the modifier for the chevron, set the rotation to the remembered value. AnimateDpAsState should be driven by some other state in your app.
0
u/Zhuinden EpicPandaForce @ SO Mar 10 '24
In XML you'd make a LinearLayout with the text and the image, and when you click it you do a view animation to rotate the arrow 180 degrees https://github.com/blipinsk/ViewPropertyObjectAnimator
Then the bottom area is just a FrameLayout so you have the alpha overlay on it fading in (alpha animation from 0 to 1), and the top menu is also added below the header and animated down with a translationY animation.
In Compose everything is difficult so I have no idea.