Ahmed
10/21/2024, 2:45 PMScrollableTabRow
. We also support localisation, therefore, some strings are short. This makes the UI end up looking like where tabs are aligned to a side only. Something like
Not scrollable case:
—————————————————————————————————
Tab1 Tab2 Tab3 Tab4
—————————————————————————————————
Any ideas or workarounds on how to fit these tabs (same weight)?Ahmed
10/21/2024, 2:51 PMSkaldebane
10/21/2024, 3:28 PMScrollableTabRow
, it's a poorly designed Material API. Doesn't help with any customization at all, doesn't expose its scroll state (why?!), Skaldebane
10/21/2024, 4:37 PMScrollableTabRow
, it'll split the width between tabs evenly (I could probably change this so it does it proportionally; larger tabs get more of the space, but manual layout is hard and I'm lazy).
If the total size of the tabs is larger, it'll function as usual, and scrolling will take effect.
I'll send a little video demo and the code in a follow-up.
PS: What a damn perfect timing, I needed this for another project that I'll get to very soon, and didn't know about ScrollableTabRow
, so it would've never occurred to me that I can easily solve it by... well stealing its code and changing it xDSkaldebane
10/21/2024, 4:47 PMSkaldebane
10/21/2024, 4:50 PMSkaldebane
10/21/2024, 5:20 PMMeasurable.maxIntrinsicWidth
.Skaldebane
10/21/2024, 5:21 PMSkaldebane
10/21/2024, 5:30 PMAhmed
10/22/2024, 5:31 AMAltynbek Nurtaza
10/24/2024, 10:27 PMvar layoutWidth = padding * 2
var layoutHeight = 0
tabPlaceables.fastForEach {
layoutWidth += it.width
layoutHeight = maxOf(layoutHeight, it.height)
}
Skaldebane
10/24/2024, 10:59 PMSkaldebane
10/24/2024, 11:03 PM