Material Design implementation in Jetpack compose of a TextField
Questions tagged [android-compose-textfield]
242 questions
5
votes
1 answer
Dynamically add views on click of Button using Jetpack Compose
I want to dynamically add Text Fields to my layout everytime user click "Add" button.Added Text Field should be added above "Add" button .i.e.between Step 1 TextField and Add Button.How can this be achieved through Jetpack Compose?Below is…

Android Developer
- 9,157
- 18
- 82
- 139
5
votes
1 answer
Jetpack Compose setting cursor on end of TextField
Wanna create TextField for phone number.
Need help with set cursor in field always in end of string
What i trying to do:
When got new number in field , i get all numbers that already entered, than append underscore( _ ) for have at least 11 string…

Boris Sadakov
- 617
- 1
- 7
- 18
5
votes
3 answers
Access TextField value from another composable function in Jetpack Compose
I have created two TextField Email, Password & Button Login. Now on click of that button I want to access text and show success/error based on validation.
The problem is they are in two different composable functions.
@Composable
fun…

Mayur Gajra
- 8,285
- 6
- 25
- 41
5
votes
1 answer
How to create a TextField with underbar, without any background or border?
I'm trying to create a TextField, in Jetpack compose with an underbar but without any other border or background. How do I do this?
This is the code I'm currently using:
val query = remember {mutableStateOf("")}
TextField(
value =…

Sparsh Dutta
- 2,450
- 4
- 27
- 54
4
votes
2 answers
How to overlay texts on an Image using jetpack compose
I am trying to make something that uses the same concept as the image below;
An image like background with text overlaying it.
I tried to make a card and give it a backgroundColor of the image, but I got an error;
What I want to do is overlay some…

Edwin
- 565
- 11
- 26
4
votes
3 answers
How to add uneditable postfix (suffix) to TextField in Jetpack Compose?
How can I add a suffix to TextField input that flows (moves) with the user input text?

Mahozad
- 18,032
- 13
- 118
- 133
4
votes
1 answer
How to add multiple Tags in Jetpack Compose
I want to achieve the same like adding tags in stackOverFlow question where we select the tags for the question how to do it in jetpack compose
like this where on clicking the "x" icon should remove the tag
I started with this way but confused…

AndroidRocket
- 418
- 3
- 14
4
votes
1 answer
Compose TextField Modifier.onFocusChanged {} event being called upon initialization even though no user focus interactions have been done
Reproducible with code:
var value by remember { mutableStateOf("Hello\nWorld\nInvisible") }
TextField(
value = value,
onValueChange = { value = it },
label = { Text("Enter text") },
modifier = Modifier
.onFocusChanged {…

jesobremonte
- 3,198
- 2
- 22
- 30
4
votes
4 answers
Restrict only numbers in TextField in jetpack compose
I want to enter only numbers in Textfield. I tried this stackoverflow logic to restrict alphabet and special characters but when I press dot in my keyboard it's crash.
Error
2022-08-18 09:47:13.966 8050-8050/com.abc.app.dev E/AndroidRuntime: FATAL…

Kotlin Learner
- 3,995
- 6
- 47
- 127
4
votes
0 answers
TextField losing focus inside LazyColumn
I'm trying to build an UI that contains a search bar inside a LazyColumn layout. The only problem is that the TextField loses focus if it is not at the top of the screen.
Code:
val listState = rememberLazyListState()
LazyColumn(
…

Stefan Todorovski
- 83
- 2
- 14
4
votes
1 answer
Jetpack compose TextField, is there a way to show a drag handle bubble to move cursor position when editing text?
When editing a TextField I would like to show a bubble at cursor position like

Tom Berghuis
- 491
- 3
- 10
- 26
4
votes
1 answer
Dense TextField in Jetpack Compose
In the old View system, we can make TextInputLayout dense using style Widget.MaterialComponents.TextInputLayout.FilledBox.Dense.
How can I create a dense variant of TextField in Compose?

Risal Fajar Amiyardi
- 749
- 6
- 23
4
votes
1 answer
Programmatically click textfield in jetpack compose
Is there a way to click textfield programmatically so when my search screen pops up, it automaticaly clicks the textfield and also pop up the keyboard. Or maybe, is there a way to know the touch event of the textfield?

Chun2Maru
- 43
- 1
- 4
3
votes
1 answer
How to chage size of input area in TextField jetpack compose
I need to make a column of 3 textfields. Each of them must be 44.dp in height, but if I'll set it then text in input area does not fit and falls down.
How it should look:
How it looks now:
My code:
@Composable
fun TestingTextInput(number: Int,…

L0mTiCk
- 31
- 2
3
votes
2 answers
TextField both KeyboardType.Number and KeyboardType.Decimal allows to type decimal separator
So I need to allow only numbers to by typed in the field.
I configured TextField with:
keyboardOptions = KeyboardOptions.Default.copy(
keyboardType = KeyboardType.Number
)
But still it allows me to type decimal separators (comma and dot)
So I…

user924
- 8,146
- 7
- 57
- 139