开源库实现字体闪烁功能

来源:互联网 发布:上烈士墙的淘宝排行榜 编辑:程序博客网 时间:2024/05/29 04:32

效果图

导入方法如下链接

点击打开链接

下载链接为

https://github.com/RomainPiel/Shimmer-android 

将该项目当做一个libary来使用

就只需要写一些代码

布局文件为

<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:textColor="#757575"          android:textSize="20sp" />    </RelativeLayout> 
设置参数代码为:

package com.xiaoke.shim;import com.romainpiel.shimmer.Shimmer;import com.romainpiel.shimmer.ShimmerTextView;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);            ShimmerTextView tv = (ShimmerTextView) findViewById(R.id.shimmer_tv);          Shimmer shimmer = new Shimmer();          //设置显示时间        shimmer.setDuration(2500);          shimmer.start(tv);      }  }  



0 0
原创粉丝点击