Questions tagged [android-compose-textfield]

Material Design implementation in Jetpack compose of a TextField

242 questions
3
votes
2 answers

Why does the cursor always appear at the start of my OutlinedTextField?

I'm working on an edit screen in Jetpack Compose and seeing behavior where, when I tap the text field for the first time, the cursor appears at the beginning of the text in the field, rather than at the end. OutlinedTextField( value =…
3
votes
1 answer

Jetpack Compose PlatformTextStyle includeFontPadding is deprecated, so what is the solution?

val headlineRegular: TextStyle = TextStyle( fontWeight = FontWeight.W400, fontSize = 16.sp, lineHeight = 22.4.sp, letterSpacing = 0.3.sp, platformStyle = PlatformTextStyle( includeFontPadding = false ), ), with…
user924
  • 8,146
  • 7
  • 57
  • 139
3
votes
0 answers

Jetpack Compose TextField - Cursor behind placeholder

Quick question here: Is this a bug inside jetpack compose TextField or am I missing something: @Composable fun TextFieldWithPlaceholder() { val text = rememberSaveable { mutableStateOf("") } Box(modifier = Modifier …
3
votes
1 answer

Text is not updating even though I am using remember and mutableStateOf

I've run into a strange issue in Jetpack Compose. I am currently working on an app which shows data on a graph from an external API. I am fetching data with no problem, but my graph didn't recompose with new values. After debugging, I started to…
3
votes
1 answer

what is the attribute of the moddifier that i need to change to make the corners rouned and the width a little smaller? jetpack Compose

my question is different from the suggested question that is similar because I am making the voting bar change in effect from the parameters of the voting percentage. therefore I need the left column to change dynamically in size and the right…
3
votes
2 answers

Jetpack compose thousands separator visual transformation that also works with a decimal

How to implement a thousands separator visual transformation which also works with decimals too. I have found an implementation of thousand separator visual transformation for Int numbers but the problem is when I want to use it for decimal numbers…
3
votes
0 answers

With AdjustResize LazyColumn TextFields on the bottom won't open keyboard

Created a LazyColumn with textFields and it seems to have issue with "android:windowSoftInputMode="adjustResize"parameter. When clicking a text field that needs to move up so it won't be hidden behind keyboard, causes issues when using AdjustResize…
3
votes
2 answers

I cannot use TextField() in jetpack Compose(Material 3)

@Composable fun EditNumberField() { TextField(value = "", onValueChange = {}){ } } It says Unresolved reference: TextField. I want a TextField so that the user can enter a value but it is showing an error.
3
votes
0 answers

stringResource vs LocalContext.current.getString in compose Android

I have created a sample app and found that when I used stringresource to fetch the string, the composable function was called two times and In the case of LocalContext.current.getString composable function was called one time. I also tested with…
3
votes
3 answers

How do I separate text and icon in TextButton

How do I separate text and icon in TextButton to make it like whatsapp settings Row( modifier = Modifier .fillMaxWidth() .height(50.dp) ) { TextButton( onClick = { /*TODO*/ }, modifier =…
3
votes
2 answers

How to reset remembered mutable state in composable?

I used this example from here: @Composable private fun TimedLayout() { var show by remember { mutableStateOf(true) } LaunchedEffect(key1 = Unit){ delay(5000) show = false } Column(modifier=Modifier.fillMaxSize()) { …
3
votes
2 answers

onValueChange of textfield is not triggered when selecting an option from exposed dropdownMenu composable, jetpack compose

I am trying to implement an exposed dropdown composable which I can use in multiple parts of my android jetpack compose app. Whenever I select an item from the dropdownMenu the selectedOption is set in the composable and assigned to the textfield…
3
votes
1 answer

How to hide TextFieldCursorHandle in Jetpack compose for TextField/BasicTextField?

The solution I have so far is to use a Transparent Color for the cursor. I am looking for a better way to hide it if there is any. cursorBrush = SolidColor(Transparent) TextField should be focused, the keyboard should be open and the user should be…
Abhimanyu
  • 11,351
  • 7
  • 51
  • 121
3
votes
1 answer

Adjust TextField label Padding in Compose with decorationBox

I am trying to adjust the start padding of the label in my TextSearchBar composable. I understand that one option is to use a BasicTextField composable but i want to avoid this and use contentPadding parameter via decorationBox added in…
mars8
  • 770
  • 1
  • 11
  • 25
3
votes
2 answers

Allow ONLY Letters in Keyboard - Jetpack Compose

I'm trying to create a TextField in Jetpack Compose for users to enter their first and last name. Is there a way to allow ONLY letters and whitespaces ([a-zA-Z\s]) as input? I've tried every single option available, including KeyboardType.Text,…
kc_dev
  • 578
  • 1
  • 6
  • 21