Questions tagged [android-compose-textfield]

Material Design implementation in Jetpack compose of a TextField

242 questions
25
votes
6 answers

Specify minimal lines for Text in Jetpack Compose

For various reasons a Text should always have at least the height equal to x lines of text, no matter if it has less than x lines of text. The Text and BasicText Composables only have a maxLines parameter but no minLines I have tried the following…
Yannick
  • 4,833
  • 8
  • 38
  • 63
22
votes
6 answers

How to override the text color in TextField in Jetpack Compose using MaterialTheme?

I'm trying to use TextField() from Jetpack Compose. I want the text color to be white. I found this to be working: ProvideTextStyle(TextStyle(color = Color.White)) { TextField( ... ) } However, I want to override this in the Theme…
21
votes
7 answers

Jetpack Compose: TextField clickable does not work

for some reason Compose TextField's click listener does not work for me. @Composable private fun ExposedDropdown( modifier: Modifier, list: List, priority: Int ) { var expanded by remember {…
18
votes
3 answers

How to prefix country code in Textfield using Jetpack Compose

I want my Textfield to be prefixed with a country code (+91), which can't be changed by the user. How do I achieve this?
17
votes
1 answer

Android Jetpack Compose TextField disable keyboard auto suggestions

I'm looking for a way to disable the keyboard auto suggestions with the TextField Composable. In the olden days of Android from about 4 months ago, using EditText you could do something like this, setting the inputType to…
17
votes
2 answers

How to outline text in Jetpack Compose

I have a Jetpack Compose Text() element that I'd like to outline in black like so . Anyone know how to do this? I've tried using the border() modifier, but that just adds a border around the rectangular area containing the text. I've also tried…
15
votes
1 answer

Is there a Jetpack Compose equivalent of A password field with the password visible to the user?

Product: Android App Programming language: kotlin When using XML to create the UI. There is an option for a password field with the password visible to the user. All the developer have to do is set the inputType =…
14
votes
1 answer

Jetpack Compose - how to center text in ClickableText

In Jetpack Compose, when using Text, we can center text using TextAlign: Text( text = "How many cars are in the garage", textAlign = TextAlign.Center ) But if we're looking to get the position of a click within a Text composable, we use…
14
votes
2 answers

Android Jetpack compose (1.0.0-beta07): TextField - None of the following functions can be called with the arguments supplied

I started working with Jetpack compose (1.0.0-beta07) and I ran into a pretty strange problem with TextField. According to all possible documentation and instructions, I do everything right, but Android Studio constantly writes me the message None…
14
votes
3 answers

Multiple colors in TextField of Jetpack Compose

Is it possible to get different colors in a TextField of Jetpack Compose? Something like with the Text composable with AnnotatedString, but TextField doesn't allow AnnotatedString as input value. Image of normal Text composable with colors
14
votes
1 answer

Partially color text and make it clickable in Jetpack Compose

For the views declared in XML we could use SpannableStringBuilder as mentioned here https://stackoverflow.com/a/4897412/9715339 to color that partial string. But with JetPack compose Text I am not able to achieve the same with only single Text. I…
14
votes
3 answers

Jetpack Compose: Disable Interaction with TextField

Is there a way to disable all interaction for Jetpack Compose's TextField?
14
votes
3 answers

How we can we format Text as superscript or subscript in Android Jetpack Compose UI?

I am working on one example using Android Jetpack Compose, where I am displaying some text equations like below :

E = mc2

CH4 + H2O = CO +…

13
votes
1 answer

Jetpack Compose ExposedDropdownMenu not showing up when pressed

I'm working on a Jetpack Compose (1.3.0-beta03) and Material3 (1.0.0-beta03) app. I'd like to show the user a simple dropdown with different languages, and the following code isn't very different from what you'll find…
13
votes
3 answers

TextField is hiding under the keyboard when focused

I have a problem with TextField that is hiding under the keyboard, I've found the answers for the similar question here, but they are not helping me in my case. I have a LazyColumn with the list of different composables in it, and when I have not…
1
2
3
16 17