代码设置TextView的drawableLeft

 Drawable drawable = ContextCompat.getDrawable(mContext, R.drawable.publish_dynamic_entry);
        int size = (int) SizeUtils.dp2Px(getResources(), 24.0f);

        // 这一步必须要做,否则不会显示.

        drawable.setBounds(0, 0, size, size);
        mPublishTv.setCompoundDrawables(drawable, null, null, null);

你可能感兴趣的:(代码设置TextView的drawableLeft)