美文网首页
TextView设置drawable设置相关

TextView设置drawable设置相关

作者: 一叶书生 | 来源:发表于2020-08-11 11:11 被阅读0次

    xml里设置

    android:drawableRight="@mipmap/company_expand_down"

    android:drawablePadding="@dimen/dp_4"

    代码设置

    Drawable drawable =mContext.getResources().getDrawable(R.mipmap.company_expand_down);

    下面这一步必须有,不然图标可显示不出来哟!!!

    drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());

    tvExpand.setCompoundDrawables(null, null, drawable, null);

    相关文章

      网友评论

          本文标题:TextView设置drawable设置相关

          本文链接:https://www.haomeiwen.com/subject/gjvedktx.html