@@ -0,0 +1,1251 @@
+package com.king.applib.util;%0A%0Aimport android.graphics.drawable.Drawable;%0Aimport android.os.Build;%0Aimport android.view.View;%0Aimport android.widget.TextView;%0A%0A/**%0A * View %E7%9B%B8%E5%85%B3%E5%B7%A5%E5%85%B7%E7%B1%BB.%0A *%0A * @author VanceKing%0A * @since 2018/1/17.%0A */%0Apublic class ViewUtil %7B%0A    private ViewUtil() %7B%0A        throw new UnsupportedOperationException(%22No instances!%22);%0A    %7D%0A%0A    /** %E5%A6%82%E6%9E%9C TextView %E4%B8%BA null %E6%88%96 TextView %E7%9A%84%E5%86%85%E5%AE%B9%E4%B8%BA%E2%80%9C%E2%80%9D/null,%E5%88%99%E8%BF%94%E5%9B%9E defaultText. */%0A    public static String getText(TextView textView, String defaultText) %7B%0A        if (textView == null) %7B%0A            return defaultText;%0A        %7D%0A        String string = textView.getText().toString();%0A        if (string.trim().isEmpty()) %7B%0A            return defaultText;%0A        %7D%0A        return string;%0A    %7D%0A%0A    /** %E5%A6%82%E6%9E%9C TextView %E4%B8%BA null,%E6%88%96 TextView %E7%9A%84%E5%86%85%E5%AE%B9%E4%B8%BA%E2%80%9C%E2%80%9D/null,%E5%88%99%E8%BF%94%E5%9B%9E%E7%A9%BA%E5%AD%97%E7%AC%A6%E4%B8%B2 %22%22. */%0A    public static String getText(TextView textView) %7B%0A        return getText(textView, %22%22);%0A    %7D%0A%0A    /** View %E8%AE%BE%E7%BD%AE%E8%83%8C%E6%99%AF%E7%9A%84%E5%85%BC%E5%AE%B9%E6%96%B9%E6%B3%95 */%0A    public static void setViewBackground(View view, Drawable drawable) %7B%0A        if (view == null) %7B%0A            return;%0A        %7D%0A        if (Build.VERSION.SDK_INT %3E= Build.VERSION_CODES.JELLY_BEAN) %7B%0A            view.setBackground(drawable);%0A        %7D else %7B%0A            view.setBackgroundDrawable(drawable);%0A        %7D%0A    %7D%0A%7D%0A

添加 View 相关工具类