Changing the Status Bar Colour in Android in Xamarin

If you're using AppCompatActivity and want to change the status bar colour to any colour you want, first you'll need to add this line inside your styles.xml:

<!-- Status Bar Colour -->
<item name="android:statusBarColor">@color/primary</item>

...And then, inside your Activity inside the OnCreate function, add this line:

Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);

 Congrats! Now your Status bar should have changed colour to @color/primary. Change the @color/primary to whatever colour you want.

RecyclerView Animation

https://proandroiddev.com/enter-animation-using-recyclerview-and-layoutanimation-part-1-list-75a874a5d213

Using Glide to load image into ImageView

Now, if you load images from external URLs into your ImageViews inside a RecyclerView (usually inside the OnBindViewHolder method), chances are your RecyclerView will be pretty sluggish upon first load.

This is simply because everything is fetched from the URL and loaded before the RecyclerView UI is updated.

So, let's use Glide, which not only solves that problem, but also automatically caches all images that you load inside an Android app!

Reference: 

https://github.com/beraybentesen/glide-xamarin-android

https://www.nuget.org/packages/Glide.Xamarin/3.8.0

 

 

"The specified path, file name, or both are too long" while archiving Xamarin builds in Archive Manager

If you have a long default path, you're going to inevitable hit this error while archiving your Xamarin builds:

The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

Actually, your app have already been archived.

Simply close the Archive Manager. And then open it again at Tools > Archive Manager.

Now you can Distribute it like usual.

-------------------------------

And if you're using Windows 10 Anniversary Update, it does not hurt to enable long path inside Windows.

  1. Press Windows key + R to open the Run dialog. Type gpedit.msc.
  2. Navigate to: Computer Configuration > Administrative Templates > System > Filesystem
  3. Double click on "Enable Win32 long paths". Enable it.
    1. Alternatively, if you don't see this option click on NTFS > Enable NTFS long path.
  4. Restart Visual Studio 2017. Done!