Questions tagged [android-jetpack]

Android Jetpack is a Google's set of libraries, tools and architectural guidance to build Android apps and provides common infrastructure code.

Android Jetpack is the next generation of Android components, bringing together the benefits of the Support Library -- backwards compatibility and immediate updates -- to a larger set of components, making it quick and easy to build robust, high quality apps.

It manages activities like background tasks, navigation, and lifecycle management, so you can eliminate boilerplate code and focus on what makes your app great.

It is designed to work well with Kotlin, saving you even more code with Android KTX. The new Android Jetpack components released today include WorkManager, Paging, Navigation, and Slices.

Useful Links

2879 questions
1
vote
2 answers

How to add an icon to canvas in Jetpack Compose?

I am trying to add and icon from resource in Canvas DrawScope. The nearest solution I found is drawImage(), but it doesn't work for my case. Also I cannot use the normal Icon() composable inside the DrawScope. So is there any work around to display…
1
vote
1 answer

How to draw gradient and customize your splash screen in compose?

I am trying to have a splash screen in our application and I got stuck Abit with the jetpack Compose design. So I want to have a background gradient, I am now using the image which does not fit well in the phone and want to center my logo and text…
Suraya
  • 63
  • 7
1
vote
0 answers

How can I selectively disable android:windowSoftInputMode="adjustResize" from manifest file?

Initially I want to show a composable immediately on top of the Android default keyboard, what slides in if needed on my different screens. Similar like in this example, but I do not want to set WindowCompat.setDecorFitsSystemWindows(window, false),…
1
vote
2 answers

How to retrigger focusRequester.requestFocus() when coming back to a composable?

I have a MyBasicTextField in a composable to request user input: @Composable fun MyBasicTextField() { val keyboardController = LocalSoftwareKeyboardController.current val focusRequester = remember{ FocusRequester() } BasicTextField( …
1
vote
2 answers

Zoomable Image ignores Box() dimension after upgrading Jetpack Compose

After upgrading from compose 1.0.1 to 1.3.0-beta01 my Zoomable Image is ignoring the parent Box dimensions (250x250) I can even zoom it so large that It reaches over the TopAppBar… I didn't changed anything on the code, just simply upgraded to the…
HavanaSun
  • 446
  • 3
  • 12
  • 39
1
vote
1 answer

How to activate Baseline Profiles - Android?

I generated Baseline Profiles and saw promising results in my Macrobenchmark test: I put the baseline-prof.txt file in the main folder next to the Manifest.xml. When I run the app in release mode I cannot see a visible difference when performing…
1
vote
3 answers

How to make Surface background transparent (Jetpack Compose)

I have such an implemenation Surface( modifier = Modifier.background(Color.Transparent), shape = RoundedCornerShape(corner = CornerSize(2.dp)), border = BorderStroke(width = 1.dp, color =…
1
vote
2 answers

View.GONE alternative in Jetpack Compose?

I'll give an example of the problem, let's say I have two buttons within the Box @Preview @Composable fun testView() { Box(modifier = Modifier .size(200.dp) ) { Button(onClick = { Log.e("HERE", "First btn") …
Sirop4ik
  • 4,543
  • 2
  • 54
  • 121
1
vote
1 answer

(Jetpack Compose) How to calculate parallax correctly?

I need to do a parallax implementation and in addition when user is scrolling down actionbar should appear. I am following this tutorial: https://proandroiddev.com/parallax-in-jetpack-compose-bf521244f49 There is an implementation: @Composable fun…
Sirop4ik
  • 4,543
  • 2
  • 54
  • 121
1
vote
0 answers

Different layout behavior on real device and emulator (Jetpack Compose)

I'm developing a new personal project using compose and the new Material 3 components and I was just using the emulator to test it, everything was looking fine. Today, I used a real device to test it (Galaxy S10E, on Android 12 - Same version as my…
1
vote
0 answers

Navigating between nested graphs starts the enter animation of the fragment, even though the animation is only mentiond in an action

I have a bottomNavigationView that I set up with a nav controller. The nav Host graph is a navigation graph with 2 nested graphs. When I navigate between the nested graphs, there is a fragment which is then shown (The fragment which was at the top…
1
vote
0 answers

AndroidX DataStore: Multiple Profiles

In my app I'm using AndroidX DataStore to save preferences. To do this, I followed the documentation and added a Context property at file-level like this: val Context.dataStore: DataStore by preferencesDataStore(name =…
1
vote
2 answers

Why jetpack compose text colors looks different from the preview?

I am new to Jetpack compose. I am following the tutorial and the problem is that according to the tutorial the text color is black on the preview as well as on the real device (in the tutorial) on my preview I also see the color as black, however,…
Sirop4ik
  • 4,543
  • 2
  • 54
  • 121
1
vote
1 answer

How to change Wear OS complication type programmatically

I'm working on a watch face for Wear OS based on this example: https://github.com/android/wear-os-samples/tree/main/WatchFaceKotlin. Samsung Heart Rate complication has a MONOCHROMATIC_IMAGE type and it doesn't provide heart rate value. I already…
OlegMalakhov
  • 53
  • 1
  • 6
1
vote
0 answers

Fixed footer in Bottomsheet Compose

I'm trying to add a fixed button at the bottom of compose bottomsheet. The button should be visible at all times in collapsed state and should stay static at the bottom as the user slides up through the sheet. Sample behavior:…
1 2 3
99
100