我在JetPack撰写中有一个 OutlinedTextfield ,我想在波斯语的 OutlinedTextfield 的右侧更改标签方向(默认情况下是左侧)。
OutlinedTextfield
I have an OutlinedTextField in jetpack compose and I want to change the label direction to the right of OutlinedTextField for the Persian language (By default is on the left).
OutlinedTextField
使用 COMPOINTLOCALPROVIDER(LocallayOutDirection提供LayoutDirection.RTL)。
COMPOINTLOCALPROVIDER(LocallayOutDirection提供LayoutDirection.RTL)
示例代码,
@Composable fun RtlLabelInOutlineTextField() { val (digit1, setDigit1) = remember { mutableStateOf("") } CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) { OutlinedTextField( value = digit1, onValueChange = { setDigit1(it) }, label = { Text("Label") }, keyboardOptions = KeyboardOptions( keyboardType = KeyboardType.NumberPassword, imeAction = ImeAction.Next, ), modifier = Modifier.fillMaxWidth().padding(16.dp), ) } }
屏幕截图
Use CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl).
CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl)
Sample code,
Screenshots
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(1)
使用
COMPOINTLOCALPROVIDER(LocallayOutDirection提供LayoutDirection.RTL)
。示例代码,
屏幕截图
Use
CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl)
.Sample code,
Screenshots