java类android.support.annotation.StyleableRes的实例源码

TextViewAttrHelper.java 文件源码 项目:Android-Client 阅读 34 收藏 0 点赞 0 评论 0
public static void applyAttributes(TextView textView, @Nullable AttributeSet attrs, @StyleableRes int[] styleableIds, @StyleableRes int fontStyableId) {
    Context context = textView.getContext();

    Typeface typeface = Font.MEDIUM.getTypeface(context);

    if (attrs != null) {
        TypedArray typedArray = context.obtainStyledAttributes(attrs, styleableIds);

        int fontId = typedArray.getInt(fontStyableId, Font.MEDIUM.getId());
        typeface = Font.fromId(fontId).getTypeface(context);

        typedArray.recycle();
    }

    textView.setTypeface(typeface);
}
ResourceProvider.java 文件源码 项目:StickyScrollView 阅读 30 收藏 0 点赞 0 评论 0
public ResourceProvider(Context context, AttributeSet attrs, @StyleableRes int[] styleRes) {
    mTypeArray = context.obtainStyledAttributes(attrs, styleRes);
}
ResourceProvider.java 文件源码 项目:StickyScrollView 阅读 28 收藏 0 点赞 0 评论 0
@Override
public int getResourceId(@StyleableRes int styleResId) {
    return mTypeArray.getResourceId(styleResId, 0);
}
TypedArrayUtils.java 文件源码 项目:letv 阅读 27 收藏 0 点赞 0 评论 0
public static boolean getBoolean(TypedArray a, @StyleableRes int index, @StyleableRes int fallbackIndex, boolean defaultValue) {
    return a.getBoolean(index, a.getBoolean(fallbackIndex, defaultValue));
}
TypedArrayUtils.java 文件源码 项目:letv 阅读 27 收藏 0 点赞 0 评论 0
public static int getInt(TypedArray a, @StyleableRes int index, @StyleableRes int fallbackIndex, int defaultValue) {
    return a.getInt(index, a.getInt(fallbackIndex, defaultValue));
}
TypedArrayUtils.java 文件源码 项目:letv 阅读 24 收藏 0 点赞 0 评论 0
@AnyRes
public static int getResourceId(TypedArray a, @StyleableRes int index, @StyleableRes int fallbackIndex, @AnyRes int defaultValue) {
    return a.getResourceId(index, a.getResourceId(fallbackIndex, defaultValue));
}
IntegerSimpleMenuPreference.java 文件源码 项目:FontProvider 阅读 26 收藏 0 点赞 0 评论 0
@SuppressLint("RestrictedApi")
private static int[] getIntArray(TypedArray a, @StyleableRes int index,
                                 @StyleableRes int fallbackIndex) {
    int resourceId = TypedArrayUtils.getResourceId(a, index, fallbackIndex, 0);
    return a.getResources().getIntArray(resourceId);
}
TypedArrayUtils.java 文件源码 项目:boohee_v5.6 阅读 28 收藏 0 点赞 0 评论 0
public static boolean getBoolean(TypedArray a, @StyleableRes int index, @StyleableRes int fallbackIndex, boolean defaultValue) {
    return a.getBoolean(index, a.getBoolean(fallbackIndex, defaultValue));
}
TypedArrayUtils.java 文件源码 项目:boohee_v5.6 阅读 25 收藏 0 点赞 0 评论 0
public static int getInt(TypedArray a, @StyleableRes int index, @StyleableRes int fallbackIndex, int defaultValue) {
    return a.getInt(index, a.getInt(fallbackIndex, defaultValue));
}
TypedArrayUtils.java 文件源码 项目:boohee_v5.6 阅读 24 收藏 0 点赞 0 评论 0
@AnyRes
public static int getResourceId(TypedArray a, @StyleableRes int index, @StyleableRes int fallbackIndex, @AnyRes int defaultValue) {
    return a.getResourceId(index, a.getResourceId(fallbackIndex, defaultValue));
}


问题


面经


文章

微信
公众号

扫码关注公众号