shimmer使用方法(文本閃爍)

1.github下載  https://github.com/facebook/shimmer-androidjava

2.copy ShimmerFrameLayout.java 連同包名到java目錄android

3.copy attrs.xml 到 values 目錄git

4.github

<com.facebook.shimmer.ShimmerFrameLayout
        android:id="@+id/shimmer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Hello World!Hello World!Hello World!Hello World!Hello World!" />
</com.facebook.shimmer.ShimmerFrameLayout>

5.spa

ShimmerFrameLayout shimmar = (ShimmerFrameLayout) findViewById(R.id.shimmer);
shimmar.startShimmerAnimation();

注:各類style3d

        mShimmerViewContainer.setDuration(5000);
        mShimmerViewContainer.setRepeatMode(ObjectAnimator.REVERSE);

        mShimmerViewContainer.setBaseAlpha(0.1f);
        mShimmerViewContainer.setDropoff(0.1f);
        mShimmerViewContainer.setTilt(0);

        mShimmerViewContainer.setAngle(ShimmerFrameLayout.MaskAngle.CW_90);

        mShimmerViewContainer.setBaseAlpha(0);
        mShimmerViewContainer.setDuration(2000);
        mShimmerViewContainer.setDropoff(0.1f);
        mShimmerViewContainer.setIntensity(0.35f);
        mShimmerViewContainer.setMaskShape(ShimmerFrameLayout.MaskShape.RADIAL);
相關文章
相關標籤/搜索