public static void settingDrawableTop(Context context, TextView view , int resourcesDrawable, int resourcesString){
view.setVisibility(View.VISIBLE);
Drawable drawable = null;
drawable = context.getResources().getDrawable(resourcesDrawable);
if(drawable != null){
drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); //设置边界
view.setCompoundDrawables(null, drawable, null, null);//图在上边
view.setText(resourcesString);
}
}
转载于:https://www.cnblogs.com/xiaopengs/p/6806252.html