KotlinLeaner
01/20/2025, 2:19 PMKotlinLeaner
01/20/2025, 2:19 PMkeyboardOptions
to KeyboardOptions(keyboardType = KeyboardType.Password)
as it effectively removes the underline.Raphael TEYSSANDIER
01/20/2025, 2:20 PMKotlinLeaner
01/20/2025, 2:20 PMBasicTextField(
state = state,
modifier = Modifier
.fillMaxWidth()
.padding(20.dp),
interactionSource = interactionSource,
enabled = true,
lineLimits = TextFieldLineLimits.SingleLine,
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Text,
autoCorrectEnabled = false
),
textStyle = LocalTextStyle.current,
decorator = TextFieldDefaults.decorator(
state = state,
enabled = true,
lineLimits = TextFieldLineLimits.Default,
interactionSource = interactionSource,
outputTransformation = null,
),
)
What I need is a way to remove the underline from the BasicTextField while retaining normal keyboard and clipboard behavior.
How can I achieve this? Is there a better way to customize the underline appearance without relying on KeyboardType.Password? Any guidance or examples would be greatly appreciated!KotlinLeaner
01/20/2025, 2:21 PMKotlinLeaner
01/20/2025, 2:28 PMRaphael TEYSSANDIER
01/20/2025, 2:30 PMdecorationBox = {
TextFieldDefaults.DecorationBox(
value = value,
innerTextField = it,
enabled = true,
singleLine = singleLine,
visualTransformation = VisualTransformation.None,
interactionSource = remember { MutableInteractionSource() },
isError = isError,
label = null,
placeholder = null,
leadingIcon = leadingIcon,
trailingIcon = null,
prefix = null,
suffix = null,
supportingText = null,
shape = TextFieldDefaults.shape,
colors = colors(
errorContainerColor = colors.StatusError
),
contentPadding = contentPaddingWithLabel(),
container = {}
)
}
Raphael TEYSSANDIER
01/20/2025, 2:30 PMKotlinLeaner
01/20/2025, 2:31 PMRaphael TEYSSANDIER
01/20/2025, 2:37 PMKotlinLeaner
01/20/2025, 2:37 PMKotlinLeaner
01/20/2025, 2:37 PMRaphael TEYSSANDIER
01/20/2025, 2:37 PMKotlinLeaner
01/20/2025, 2:38 PMRaphael TEYSSANDIER
01/20/2025, 2:38 PMKotlinLeaner
01/20/2025, 2:39 PMdfdfg
text underline.Raphael TEYSSANDIER
01/20/2025, 2:44 PMvisualTransformation = VisualTransformation.None,
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Password
),
KotlinLeaner
01/20/2025, 2:47 PMRaphael TEYSSANDIER
01/20/2025, 3:06 PMKotlinLeaner
01/20/2025, 3:18 PMZach Klippenstein (he/him) [MOD]
01/20/2025, 6:06 PMZach Klippenstein (he/him) [MOD]
01/20/2025, 6:06 PMKotlinLeaner
01/20/2025, 6:12 PMZach Klippenstein (he/him) [MOD]
01/20/2025, 6:24 PMautoCorrectEnabled
in your KeyboardOptions
work?KotlinLeaner
01/20/2025, 6:26 PMautoCorrectEnabled
and it's not working, please have a look on this code.Zach Klippenstein (he/him) [MOD]
01/20/2025, 6:28 PMPlatformTextInterceptor
to manually configure the flags you need on EditorInfo
to exactly what you had before.Zach Klippenstein (he/him) [MOD]
01/20/2025, 6:29 PMKeyboardOptions
KotlinLeaner
01/20/2025, 6:30 PMZach Klippenstein (he/him) [MOD]
01/20/2025, 6:31 PMKotlinLeaner
01/20/2025, 6:55 PMssetContent {
val textFieldState = remember { TextFieldState() }
val interactionSource = remember { MutableInteractionSource() }
InterceptPlatformTextInput(
interceptor = { request, nextHandler ->
val modifiedRequest = PlatformTextInputMethodRequest { outAttributes ->
request.createInputConnection(outAttributes).also {
outAttributes.inputType = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
}
}
nextHandler.startInputMethod(modifiedRequest)
}
) {
BasicTextField(
state = textFieldState,
modifier = Modifier
.fillMaxWidth()
.padding(100.dp),
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Text,
autoCorrectEnabled = false,
),
decorator = { view ->
TextFieldDefaults.DecorationBox(
value = textFieldState.text.toString(),
innerTextField = view,
enabled = true,
singleLine = true,
interactionSource = interactionSource,
placeholder = {
Text("Only Letter")
},
visualTransformation = VisualTransformation.None
)
}
)
}
Zach Klippenstein (he/him) [MOD]
01/20/2025, 7:15 PMZach Klippenstein (he/him) [MOD]
01/20/2025, 7:16 PMKotlinLeaner
01/20/2025, 7:17 PMKotlinLeaner
01/20/2025, 7:17 PMoutAttributes.inputType = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
KotlinLeaner
01/20/2025, 7:54 PMrequest.createInputConnection(outAttributes).also {
outAttributes.inputType = InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
}
Zach Klippenstein (he/him) [MOD]
01/21/2025, 3:07 PMKotlinLeaner
01/24/2025, 1:02 PMKotlinLeaner
01/24/2025, 1:02 PM