How to Create a Shimmer Loading Effect in Jetpack Compose (WITHOUT Library!)

How to Create a Shimmer Loading Effect in Jetpack Compose (WITHOUT Library!)

Philipp Lackner

1 год назад

29,320 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@lovebondsin7071
@lovebondsin7071 - 01.10.2023 20:57

Can we do it in xml without compose and without use of any library?

Ответить
@bestapps4709
@bestapps4709 - 21.09.2023 11:08

Exist an api that can make awesome texts with 2 colors etc...?

Ответить
@ytkingmubarak
@ytkingmubarak - 02.09.2023 13:00

The one and only a professional developer who does not wear any spec to write code!!

Ответить
@akeemaweda1716
@akeemaweda1716 - 26.08.2023 09:54

Perfect! Thanks Philipp.

Ответить
@ajuv001
@ajuv001 - 08.08.2023 05:11

I tried your code in my project, gradient is coming but not animating. I tried executing your code and tried replacing your code with my code , it's working there. Any idea what could be the issue?

Ответить
@John-qt6qk
@John-qt6qk - 04.07.2023 23:41

Thanks Philipp Lackner I just adapted it to my project and it looks like awesome 😁

Ответить
@Joro2933
@Joro2933 - 12.06.2023 00:53

Man, that`s wonderfull! Thank you!

Ответить
@catb801106
@catb801106 - 01.06.2023 05:42

Is it possible to detect the size of contentAfterLoading sub-conponent , iterate it and auto generate the shimmer effect box for that ?

Ответить
@abdomostafa4512
@abdomostafa4512 - 03.03.2023 18:31

so complicated
I prefer doing that with a library

Ответить
@me-kl7bq
@me-kl7bq - 27.01.2023 12:24

Can u create content that is more beginner friendly as well?

Ответить
@heshamabdo6024
@heshamabdo6024 - 22.01.2023 02:24

fun Modifier.shimmerEffect(speed:Int = 1100) : Modifier = composed {

var size by remember { mutableStateOf(IntSize.Zero) }

val translation = rememberInfiniteTransition()

val startOffsetX by translation.animateFloat(
initialValue = -2 * size.width.toFloat(),
targetValue = 2 * size.width.toFloat(),
animationSpec = infiniteRepeatable(animation = tween(speed))
)

background(
brush = Brush.linearGradient(
colors = listOf(
Color(0xFFB8B5B5),
Color(0xFF8B8A8A),
Color(0xFFB8B5B5)
),
start = Offset ( x = startOffsetX , y = 0f ),
end = Offset ( x = startOffsetX + size.width.toFloat() , y = size.height.toFloat() )
)
).onGloballyPositioned {
size = it.size
}

}

Ответить
@NecoRuChannel
@NecoRuChannel - 16.01.2023 18:21

Phillip you are the best!! Thank you!! It is great tutorial like all yours tutorials !!

Ответить
@remydupont7454
@remydupont7454 - 16.01.2023 17:59

Very interesting.
Just wondering if it's really performant to use the background modifier and offset.
What's about to replace with drawBehind and offset lambdas? Can it skip the measure phase?
Sorry if I'm wrong, still learning Compose (Learned a lot from you)

Anyway thank you for this tutorial, great job. Can now create custom modifiers

Ответить
@Deathfang89
@Deathfang89 - 16.01.2023 15:32

Great content man.
What theme are you using in AS?

Ответить
@hocinehope8880
@hocinehope8880 - 16.01.2023 13:39

This guy is amazing

Ответить
@safionweb
@safionweb - 16.01.2023 09:18

Ответить
@proandroiddevir
@proandroiddevir - 15.01.2023 21:56

Thanks 🙏🙏🙏

Ответить
@Pulat3105
@Pulat3105 - 15.01.2023 20:51

When you make a video about chatGPT and its thread to android developers?

Ответить
@hillalroy
@hillalroy - 15.01.2023 19:51

one android tv app with exoplayer tutorial plz

Ответить
@mustafaammar551
@mustafaammar551 - 15.01.2023 18:43

Thank you bro

Ответить
@bek_groider
@bek_groider - 15.01.2023 17:50

I think, in compose we shouldn't rely on libraries. Compose let's us customize manage view easily. It is not Xml anymore

Ответить
@bek_groider
@bek_groider - 15.01.2023 17:48

hey Philipp thanks for great video! :) btw do you still you twitter if so drop you link pls

Ответить
@nfaical3
@nfaical3 - 15.01.2023 17:36

Thanks a lot :-)

Ответить
@KamalKumar-mi9lr
@KamalKumar-mi9lr - 15.01.2023 17:27

Hi man , Can we get any tutorial about activity tracking ?

Ответить
@iliasreventon8763
@iliasreventon8763 - 15.01.2023 16:42

do you believe that xml is going to be deprecated in the next five years?

Ответить
@original_anu
@original_anu - 15.01.2023 16:03

This removes my accompanist dependency. Cheers ❤

Ответить
@Alchemist10241
@Alchemist10241 - 15.01.2023 15:33

thanks, you're videos keep me up to date with the absolutely necessary information not like google IO which shows a lot of unnecessary information.

Ответить
@baharudinmaulana78
@baharudinmaulana78 - 15.01.2023 14:34

Cooollll Philips, i directly to implement to my own project , thanks a lot.

Ответить
@techienomadiso8970
@techienomadiso8970 - 15.01.2023 14:22

Good stuff

Ответить
@shubanaslam1983
@shubanaslam1983 - 15.01.2023 14:19

Osm

Ответить
@argahutama
@argahutama - 15.01.2023 14:12

Cool!

Ответить
@moonlight3695
@moonlight3695 - 15.01.2023 14:02

First

Ответить