mirror of
https://github.com/niushuai233/DevControl.git
synced 2024-10-27 22:43:20 +08:00
fix: 设置回显数据
This commit is contained in:
@@ -4,8 +4,11 @@ import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.util.TypedValue;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
|
||||
public class UiUtil {
|
||||
|
||||
public static int dip2px(Context context, float dipValue) {
|
||||
@@ -17,4 +20,15 @@ public class UiUtil {
|
||||
public static String getTextViewTextById(Activity activity, int id) {
|
||||
return ((TextView) activity.findViewById(id)).getText().toString();
|
||||
}
|
||||
|
||||
public static void setTextViewTextById(Activity activity, int id, String text) {
|
||||
((TextView) activity.findViewById(id)).setText(text);
|
||||
}
|
||||
|
||||
public static void setImageResource(Activity activity, int id, int resId) {
|
||||
((ImageView) activity.findViewById(id)).setImageResource(resId);
|
||||
}
|
||||
public static void setAppImageCompatResource(Activity activity, int id, int resId) {
|
||||
((AppCompatImageView) activity.findViewById(id)).setImageResource(resId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user