Android MotionLayout, как изменить его высоту?
Как я могу изменить высоту моего motionLayout при пролистывании. С моим текущим кодом я могу только перевести представление (но тогда я останусь там серым). Мне нужно изменить его размер, так как этот заголовок используется в нескольких фрагментах, включая некоторые PreferenceCompat, и, следовательно, я хочу, чтобы он был оберткой содержимого. чтобы добавить под ним несоставные представления.
В настоящее время, если я проведу пальцем вверх, мой взгляд поднимется ->, но останется серым
У меня есть этот motionLayout:
@OptIn(ExperimentalMotionApi::class)
@Composable
fun AddressableMotionLayout(
item: XCCAddressableReference,
listener: AddressableInfoContentAdapter.AddressableClickListener?,
) {
val context = LocalContext.current
val motionScene = remember {
context.resources
.openRawResource(R.raw.motion_scene)
.readBytes()
.decodeToString()
}
val motionState = rememberMotionLayoutState()
val corners = 10f - ((motionState.currentProgress * 10)).coerceAtMost(10f)
MotionLayout(
motionScene = MotionScene(content = motionScene),
motionLayoutState = motionState,
modifier = Modifier
.background(Color.LightGray)
) {
Box(
modifier = Modifier
.layoutId("header")
.background(colorResource(id = R.color.xelionMainColor))
)
Box(
modifier = Modifier
.fillMaxHeight()
.background(Color.White, shape = RoundedCornerShape(topStart = corners, topEnd = corners))
.layoutId("contentBg")
)
Button(
onClick = {
},
colors = ButtonDefaults.buttonColors(contentColor = Color.White),
modifier = Modifier.layoutId("menu"), contentPadding = PaddingValues(4.dp),
) {
Icon(
Icons.Default.ArrowBack,
contentDescription = ""
)
}
}
}
Это моя motion_scene:
{
ConstraintSets: {
start: {
header: {
width: 'parent',
height: 250,
top: ['parent', 'top', 0],
start: ['parent', 'start', 0],
end: ['parent', 'end', 0],
translationY: 0,
alpha: 1
},
contentBg: {
width: 'spread',
height: 0,
start: ['parent', 'start',16],
end: ['parent', 'end',16],
top: ['parent','top', 200],
bottom: ['parent','bottom'],
},
menu: {
width: 38,
height: 38,
start: ['parent', 'start', 16],
top: ['parent', 'top', 16],
},
},
end: {
header: {
width: 'parent',
height: 250,
top: ['parent', 'top', 0],
start: ['parent', 'start', 0],
end: ['parent', 'end', 0],
translationY: -250,
alpha: 1,
},
contentBg: {
width: 'spread',
height: 0,
start: ['parent', 'start'],
end: ['parent', 'end'],
top: ['parent','top'],
bottom: ['parent','bottom'],
},
menu: {
width: 38,
height: 38,
start: ['parent', 'start', 16],
top: ['parent', 'top', 16],
},
},
},
Transitions: {
default: {
from: 'start',
to: 'end',
onSwipe: {
anchor: 'contentBg',
direction: 'up',
side: 'top',
},
}
}
}