FaceBook flashes in the dark --- third-party open source -- shimmer-android, facebookandroidsdk

Source: Internet
Author: User

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}


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.