Skip to main content
227 votes
13 answers
159k views

I am trying to show a Toast message when I click on the item, but how do I get the context to pass the Toast class? fun createListItem(itemIndex: Int) { Padding(left = 8.dp, right = 8.dp, top = 8....
Mr. Tayyab MuGhal's user avatar
211 votes
13 answers
71k views

I'm trying to get a value from LiveData with observeAsState in jetpack compose, but I get a weird error Type 'State<List?>' has no method 'getValue(Nothing?, KProperty<*>)' and thus it ...
SNM's user avatar
  • 6,985
204 votes
9 answers
158k views

How exactly can you add Margin in Jetpack Compose? I can see that there is a Modifier for padding with Modifier.padding(...), but I can't seem to find one for margins. Or am I blind?
Archie G. Quiñones's user avatar
193 votes
19 answers
282k views

I'm creating a layout with Jetpack Compose and there is a column. I would like center items inside this column: Column(modifier = ExpandedWidth) { Text(text = item.title) Text(text = ...
mac229's user avatar
  • 5,039
185 votes
28 answers
169k views

I was tried to run my code in Kotlin 1.5.10 With plugin as plugins { id 'com.android.application' id 'kotlin-android' id 'kotlin-kapt' id 'dagger.hilt.android.plugin' } and ...
Lang Minh Nguyên's user avatar
163 votes
13 answers
98k views

In Jetpack Compose, when you enable clickable {} on a modifier for a composable, by default it enables ripple effect for it. How to disable this behavior? Example code Row(modifier = Modifier ...
ImMathan's user avatar
  • 5,071
146 votes
10 answers
128k views

I am wondering how to get the screen width and height with Jetpack Compose? Is there any way you can retrieve the screen dimensions other than getWindowManager().getDefaultDisplay()?
AbdulMomen عبدالمؤمن's user avatar
143 votes
10 answers
86k views

I'm using the Jetpack Compose TextField and I want to close the virtual keyboard when the user press the the action button (imeActionPerformed parameter). val text = +state { "" } TextField( ...
nglauber's user avatar
  • 24.6k
134 votes
8 answers
52k views

I recently started working with Jetpack Compose. I've got the following composable: @Composable fun SearchScreen(navController: NavHostController) { Scaffold( topBar = { SearchBar() }, ...
BenjyTec's user avatar
  • 12.9k
132 votes
7 answers
95k views

How to auto focus on textfield in jetpack compose. When i click on textfield and start typing on it. Meantime when i click back button,then when i'm try to click on textfield, nothing happens. val ...
Mukul jangir's user avatar
  • 1,421
131 votes
4 answers
92k views

There're many oft-used material icons in androidx.compose.material.icons.Icons but some are missing. Just as an example there is no print icon. ... import androidx.compose.material.Icon import ...
Valeriy Katkov's user avatar
130 votes
12 answers
169k views

I have tried below code but it reflects nothing in the UI, I'm missing anything here? class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { ...
Malik's user avatar
  • 5,133
126 votes
1 answer
90k views

I am trying to create a Column in Jetpack Compose with a specific amount of spacing between each child element, such as 10.dp. In SwiftUI, this is relatively simple. I would just create a VStack with ...
Eugene's user avatar
  • 4,716
123 votes
24 answers
77k views

How can i add hyperlink to some section of the text of Text component? With buildAnnotatedString i can set link section blue and underlined as in image below, but how can i also turn that section ...
Thracian's user avatar
  • 70.3k
123 votes
6 answers
91k views

The documentation describes how to create UI Jetpack Compose inside Activity. class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(...
Nurseyit Tursunkulov's user avatar

15 30 50 per page
1
2 3 4 5
952