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停止。
效果如图:
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停止。
相关文章推荐
- Android编程使用自定义shape实现shadow阴影效果的方法
- android 四大组件service 音乐播放器的实现
- Android之捕获TextView超链接
- Android测试教程3--用Robotium来生自动生成操作
- android MVP框架
- android.view.WindowManager$BadTokenException:Unable to add window --token is not valid; is your acti
- Android Launcher 应用图标大小不一的情况或GirdView Item 不规则处理与解决
- android多媒体编程--画画板
- 隐藏Android下的虚拟按键
- Android NDK开发入门学习笔记(图文教程,极其详尽)
- Android布局动画简单应用
- Android广播机制概述
- android radiobutton 改变TextColor
- android图片压缩之BitmapFactory的使用
- 获取Android设备的方向
- 在Android下实现鼠标右键返回
- android开发表情输入
- Android--保持加速度传感器在屏幕关闭后运行(收集)
- android中树形json解析为对象,并通过dialog显示,多级列表
- Android界面背景图片不显示---三星手机