Sae*_*adi 3 android textfield android-jetpack-compose
我有一个jetpack compose,我想将波斯语的OutlinedTextField标签方向更改为右侧(默认情况下位于左侧)。OutlinedTextField
使用CompositionLocalProvider(LocalLayoutDirection provides 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),
)
}
}
Run Code Online (Sandbox Code Playgroud)
截图
| 归档时间: |
|
| 查看次数: |
635 次 |
| 最近记录: |