FaceBook flashes in the dark --- third-party open source -- shimmer-android, facebookandroidsdk
There are many ways to implement the shimmer effect in the shimmer flash on Android, the better of which is facebook's open-source Library: shimmer-android. Its project homepage on github is: another link to the https://github.com/facebook/shimmer-android: The http://facebook.github.io/shimmer-android/ actually points to a project.
To use facebook's Android Shimmer flash, you need to first download the jar package on its home page and then directly put it in your Eclipse project libs. Write a com. facebook. shimmer. ShimmerFrameLayout layout in the layout file to wrap your own view.
For example, a TextView:
1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 xmlns:tools="http://schemas.android.com/tools" 3 android:layout_width="match_parent" 4 android:layout_height="match_parent" 5 > 6 7 <com.facebook.shimmer.ShimmerFrameLayout 8 android:id="@+id/shimmer_view_container" 9 android:layout_width="wrap_content"10 android:layout_height="wrap_content"11 android:layout_centerInParent="true" >12 13 <TextView14 android:layout_width="wrap_content"15 android:layout_height="wrap_content"16 android:background="#ffc400"17 android:padding="10dip"18 android:text="android"19 android:textColor="#eeeeee"20 android:textSize="20sp" />21 </com.facebook.shimmer.ShimmerFrameLayout>22 23 </RelativeLayout>
1 package com. zzw. shimmer; 2 3 import com. facebook. shimmer. shimmerFrameLayout; 4 5 import android. app. activity; 6 import android. OS. bundle; 7 8 public class MainActivity extends Activity {9 10 @ Override11 protected void onCreate (Bundle savedInstanceState) {12 super. onCreate (savedInstanceState); 13 setContentView (R. layout. activity_main); 14 15 ShimmerFrameLayout container = (ShimmerFrameLayout) findViewById (R. id. shimmer_view_container); 16 17 // the execution time is 18 container. setDuration (2500); 19 20 // start execution effect 21 container. startShimmerAnimation (); 22} 23}