【发布时间】:2022-01-02 12:29:40
【问题描述】:
我可以使用 Scaffold 在 JetpackCompose 中拥有 Navigation Drawer。
但是当我改变 drawbleShape 的大小时,它会将固定宽度设置为默认大小。
Scaffold(
drawerContent = { DrawableCompose() },
drawableShape = MaterialTheme.shapes.small
) {}
我参考这篇文章,How to set the Scaffold Drawer Width in JetpackCompose?
但它会像孩子一样写作,
Scaffold(
drawerContent = { DrawableCompose() },
drawableShape = customShape()
) {}
@Composable
fun customShape() = object : Shape {
override fun createOutline(
size: Size,
layoutDirection: LayoutDirection,
density: Density
): Outline {
return Outline.Rectangle(Rect(left = 0f, top = 0f, right = size.width * 2 / 3, bottom = size.height))
}
DrawerCompose
@Composable
fun DrawerCompose(
id: String
) {
val focusManager = LocalFocusManager.current
val keyboardController = LocalSoftwareKeyboardController.current
Column(modifier = Modifier.fillMaxSize()) {
OutlinedTextField(value = id, onValueChange = { onChangeEmpNo(it) }, modifier = Modifier.fillMaxWidth())
}
}
如上图,部分部分被剪掉。 有没有办法设置宽度抽屉组合宽度?
【问题讨论】:
标签: android-jetpack-compose drawer