Android Shimmer微光闪烁shimmer-android
2015-11-08 22:34
447 查看
Android Shimmer微光闪烁shimmer-android
Android上的微光闪烁shimmer效果,实现的手段不少,其中比较好的是facebook做的开源库:shimmer-android,其在github上的项目主页是:https://github.com/facebook/shimmer-android
另外一个链接:http://facebook.github.io/shimmer-android/ 其实指向的项目都是一个项目内容。
要使用facebook的Android Shimmer微光闪烁,需要先到其主页下载jar包,下载后直接放到自己Eclipse的项目libs里面。然后在布局文件中写一个com.facebook.shimmer.ShimmerFrameLayout布局,包裹自己的view比如一个TextView:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="zhangphil.shimmer.MainActivity" >
<com.facebook.shimmer.ShimmerFrameLayout
android:id="@+id/shimmer_view_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffc400"
android:padding="10dip"
android:text="Zhang Phil @CSDN"
android:textColor="#eeeeee"
android:textSize="20sp" />
</com.facebook.shimmer.ShimmerFrameLayout>
</RelativeLayout>
在Java代码里面,startShimmerAnimation()即开始执行:
package zhangphil.shimmer;
import com.facebook.shimmer.ShimmerFrameLayout;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ShimmerFrameLayout container = (ShimmerFrameLayout) findViewById(R.id.shimmer_view_container);
//执行的时长
container.setDuration(2500);
//开始执行效果
container.startShimmerAnimation();
}
}
Android Shimmer微光闪烁shimmer-android
Android上的微光闪烁shimmer效果,实现的手段不少,其中比较好的是facebook做的开源库:shimmer-android,其在github上的项目主页是:https://github.com/facebook/shimmer-android
另外一个链接:http://facebook.github.io/shimmer-android/ 其实指向的项目都是一个项目内容。
要使用facebook的Android Shimmer微光闪烁,需要先到其主页下载jar包,下载后直接放到自己Eclipse的项目libs里面。然后在布局文件中写一个com.facebook.shimmer.ShimmerFrameLayout布局,包裹自己的view比如一个TextView:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="zhangphil.shimmer.MainActivity" >
<com.facebook.shimmer.ShimmerFrameLayout
android:id="@+id/shimmer_view_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffc400"
android:padding="10dip"
android:text="Zhang Phil @CSDN"
android:textColor="#eeeeee"
android:textSize="20sp" />
</com.facebook.shimmer.ShimmerFrameLayout>
</RelativeLayout>
在Java代码里面,startShimmerAnimation()即开始执行:
package zhangphil.shimmer;
import com.facebook.shimmer.ShimmerFrameLayout;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ShimmerFrameLayout container = (ShimmerFrameLayout) findViewById(R.id.shimmer_view_container);
//执行的时长
container.setDuration(2500);
//开始执行效果
container.startShimmerAnimation();
}
}
相关文章推荐
- Android 重写系统Crash处理类,保存Crash信息到SD卡 和 完美退出程序的方法
- Android工程出现错误Unable to resolve target 'android-19'
- Android之附加图片2—— 从系统图库中选择图片
- Android 自定义万能的抽屉布局(侧滑菜单)GenericDrawerLayout
- Android中IPC的基础和几种常用方式
- Android项目开发
- Android 进程生命周期 Process Lifecycle
- Android Studio中AVD SDk找不到的解决办法
- Android打包的那些事
- Android RecyclerView(1)——范例篇
- Android Studio快捷键
- Android:Serializable接口和Parcelable接口
- Android6.0权限管理
- Android TextView跑马灯
- android顶部导航栏的封装
- Android Studio使用Github托管代码
- android获取string.xml的值
- android中的数据库操作
- apk反编译
- Android 系统信息获取(CPU,RAM,ROM,Battery,SD-card,版本等)