Hi! Does anyone know if there’s any way to use Tab...
# compose-android
s
Hi! Does anyone know if there’s any way to use TabRow but with dynamic-size tabs? I am getting multiple options with large text and as tabs are getting equal size for each one, I have no room for the text (where it shows a D… it should be a larger text) I would like not to use ScrollableTabRow. I will add a capture of my case and the desired solution.
This is the desired solution
y
IMO You can implemented a custom one
s
Yeah a custom one would be best here. Using a custom layout, shouldn't be too hard. Unrelated, but that design looks very compressed to me blob sweat smile It might not work very well on smaller screens (or large scaling), so maybe consider switching to a scrollable version when the screen width in dp is small.
s
Agree either way both of you @Yves Kalume and @Skaldebane . I have decided with the design team to find any other solution to use tab row because the result is very compressed and is not what we want. But to be honest…now I would like to achieve it 😂 . I tried to do it custom but I am struggling with the indicator to place it under the corresponding tab. I will create a gist and share if you like to help me 😊
👍 3
Thank you both!! 😉 ✌️
s
We all got that developer rage 😂 "I don't need it, but I sure as hell won't let it go" xD
As for the bottom indicator, an easy way is to just have it be part of the tab itself
But if you wanna match
TabRow
, it uses a SubcomposeLayout, to first subcompose and place all the tabs (and get their measurements), and then subcomposes the indicator based on the measured size of the tabs. I don't fully understand it, but I've recently needed to modify
ScrollableTabRow
and the code is very readable.
s
Thank you @Skaldebane!! I will check it ✌️ 🙂
✌️ 1