//第一步 导入依赖
implementation('com.dk.view.patheffect:Library:0.1.1@aar')
//第二步 xml布局
<Button
android:id="@+id/mButton"
android:text="按钮"
android:layout_width="100dp"
android:layout_height="wrap_content" />
<com.dk.view.patheffect.PathTextView
android:id="@+id/path"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
//第三步 activity里使用:
private void initView() {
mButton = (Button) findViewById(R.id.mButton);
path = (PathTextView) findViewById(R.id.path);
//粒子效果
// path.setPaintType(PathTextView.Type.MULTIPLY);
//颜色
path.setTextColor(Color.RED);
//字体大小
path.setTextSize(50);
//字体宽度
path.setTextWeight(10);
//时间
path.setDuration(4000);
mButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//只支持英文和数字(英文出来的效果是大写字母)
path.init("ni hao 123");
}
});
}
注意
minSdkVersion 16
为16 才可以使用
//------------------------------------------------------------------------------完--------------------------------------------------------------------------