您的位置:首页 > 移动开发 > Android开发

Android第三方开源: 强光效果

2015-11-19 12:42 507 查看
Shimmer-android在github上的项目主页是:https://github.com/RomainPiel/Shimmer-android 

效果如图:



Shimmer-android使用

[html] view
plaincopy

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  

    android:layout_width="match_parent"  

    android:layout_height="match_parent"  

    android:background="#9e9e9e" >  

  

    <com.romainpiel.shimmer.ShimmerTextView  

        android:id="@+id/shimmer_tv"  

        android:layout_width="match_parent"  

        android:layout_height="wrap_content"  

        android:layout_centerInParent="true"  

        android:gravity="center"  

        android:text="Android
@ CSDN"  

        android:textColor="#757575"  

        android:textSize="20sp" />  

  

</RelativeLayout>  

然后在Java代码中启动动画执行:

[java] view
plaincopy

import android.app.Activity;  

import android.os.Bundle;  

  

import com.romainpiel.shimmer.Shimmer;  

import com.romainpiel.shimmer.ShimmerTextView;  

  

public class MainActivity extends Activity {  

      

    @Override  

    protected void onCreate(Bundle savedInstanceState) {  

        super.onCreate(savedInstanceState);  

        setContentView(R.layout.activity_main);  

  

        ShimmerTextView tv = (ShimmerTextView) findViewById(R.id.shimmer_tv);  

        Shimmer shimmer = new Shimmer();  

        shimmer.setDuration(2500); 

        shimmer.start(tv);  

    }  

}  

start执行,cancel停止。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: