This is how you know if you will be Rich

If you want to be rich, then you need to start acting like a rich person. Here are some of the habits of rich people that might sound weird, but are actually very common among those who have achieved…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Shimmer Recipe for Xamarin mobile apps

Xamarin is the leading cross platform native technology to build native apps on android, ios, ipados, tizen, watchs, windows and mac using an unified open source (MIT) language called C#, used in many client and server applications. Needs a hands on lab ? Contact me on contact@vapolia.fr

Source code and links are in the appendix at the bottom of this article.

You still see a lot of spinners in apps if you are not using your fiber connection at home (i have a very good one) and the app simply waits while its data is fetched over the network. Spinners are a waste of time for the user as he is staying, stuck, looking his phone, waiting like a coconut to fall of its tree.

Instead, it should display like this:

A beautiful placeholder shimmering !

There are 3 important things braught by a shimmer:

And it’s as easy as 1,2,3 to add to your app.

Both recipes use a placeholder layout that mimics the final layout. An “IsReady” boolean is used to show/hide the placeholder layout and start/stop the shimmering animation, and the same boolean, inverted, is used to show/hide the real layout.

The animation itself is very fast, and works well in a list’s cell.

Note: Hide() does not hide the FrameLayout. It only stops the shimmer animation. You must show/hide the shimmer layout by yourself.

Note: SetIsShimmering() does not show nor hide the control. It only starts and stops the shimmer animation. You must show/hide the control by yourself.

If you use Mvvmcross, you can use a binding to display the shimmer:

The code for the Shimmering target binding is in the appendix. Register it in your Setup.cs using its Register() method.

A shimmer can be seen as a placeholder for real data. For example this shimmer:

can be a good placeholder for this data:

the real data

For white backgrounds, a good shimmer placeholder color is #d6d7dc

The shimmer animation will make this color darker. The sensation of lightning in the shimmer animation is caused by most of the placeholder content being darkened. The lightned part is not lightened: its only not darkened ! (using a gradient with a variying opacity). Make sure to understand that before choosing the best color for your app.

For android, i’m using <View /> tags with a background set to a plain color that i called placeholder (#d6d7dc).

For iOS, you may use UIView objects with a background. Or you can temporarily change the background and text colors of text items to the placeholder color: also add some fake text so text controls have a width.

If your app is using full linking in release mode on Android, add these lines to prevent the linker from optimizing away these methods:

Add a comment

Related posts:

What Is The Appropriate Image Format For Your Website?

Images are an important part of web content. They are used to tell stories, communicate a message and create an emotional connection with your visitors. It is common for them to be used in any web…

Regulatory overview of crypto assets in UAE

UAE is trying to rapidly modernize its legal system, to better compete with crypto-friendly jurisdictions such as Hong-Kong and Singapore. The federal government initiated Blockchain Strategy 2021…

Jesus Defends the Abandoned

There have been numerous studies where that have linked to isolation making it more difficult to handle stressful situations, they are more likely to be depressed and even struggle with…