codeslubber
05/01/2020, 12:13 AMLeland Richardson [G]
05/01/2020, 12:35 AMif (tooSmall(currentConfiguration)) {
MySmallSliderAlternative(...)
} else {
Slider(...)
}
currentConfiguration.screenWidth
for instanceWithConstraints {
if (it.maxWidth < MIN_SLIDER_SIZE) {
MySmallSliderAlternative(...)
} else {
Slider(...)
}
}
codeslubber
05/01/2020, 1:21 AMZach Klippenstein (he/him) [MOD]
05/01/2020, 5:06 AMdp
units it should be density-independent. Most composables also use Dp
for dimensions as well. If it's a screen size issue, you don't necessarily need to duplicate the whole layout, you can just redefine the dimension resource values.romainguy
05/01/2020, 6:36 AMLeland Richardson [G]
05/01/2020, 4:06 PMcodeslubber
05/01/2020, 6:09 PMLeland Richardson [G]
05/01/2020, 6:12 PMcodeslubber
05/01/2020, 7:30 PMLeland Richardson [G]
05/01/2020, 7:48 PMromainguy
05/01/2020, 7:55 PMcodeslubber
05/01/2020, 8:28 PMLinearLayout
code predates ConstraintLayout
and I did think about porting the view to CL, one of the documents seemed to imply that you would get a better result in adapting to a larger screen, but if it’s just doing it based on pixel density not clear how that would be.
@Leland Richardson [G] will for sure do that when I try it in compose!