Drawable drawableLeft = getResources().getDrawable(R.mipmap.logo_setting); int wh = DisplayUtils.sp2px(getActivity(), 15); // 这一步必须要做,否则不会显示。 drawableLeft.setBounds(0, 0, wh, wh);// 设置图片宽高 tv_title.setCompoundDrawables(drawableLeft, null, null, null);// 设置到控件中
安卓 xml布局中的DrawableLeft,代码的写法
最新推荐文章于 2023-02-26 09:44:02 发布