SnapWall/app/src/main/java/com/snap/wall/mytool/Mytext.java
2025-12-26 14:12:53 +08:00

35 lines
808 B
Java

package com.snap.wall.mytool;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import androidx.annotation.Nullable;
import com.snap.wall.App;
import com.snap.wall.R;
public class Mytext extends androidx.appcompat.widget.AppCompatTextView {
public Mytext(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
initAttrs(context,attrs);
}
private void initAttrs(Context context, AttributeSet attrs){
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.CustomeTv);
boolean aBoolean = typedArray.getBoolean(R.styleable.CustomeTv_apply_font,false);
if(aBoolean){
setTypeface(App.defaultFont);
}
typedArray.recycle();
}
}