Drawable drawable = getResources().getDrawable(R.drawable.icon);
drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
text.setCompoundDrawables(drawable, null, null, null);
text.setCompoundDrawablePadding(10);
drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
text.setCompoundDrawables(drawable, null, null, null);
text.setCompoundDrawablePadding(10);
本文介绍如何在Android中使用Drawable为TextView设置图标,包括获取资源、设置图标位置及填充间距。
1156

被折叠的 条评论
为什么被折叠?



