代码中设置textview的drawleft

/**
     * 设置textview 的drawable属性
     *
     * @param attention
     * @param drawableId
     */
    private void setDrawableLeft(TextView attention, int drawableId) {
        Drawable drawable = getResources().getDrawable(drawableId);
        drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
        attention.setCompoundDrawables(drawable, null, null, null);
    }

你可能感兴趣的:(android,控件)