TextView with ImageSpan messes up line height

自古美人都是妖i 提交于 2019-12-04 10:53:29

Try to set a height to the drawable you want to show with the ImageSpan. For example like this:

Drawable vegetary = mContext.getResources().getDrawable(R.drawable.ic_best_veget);
    vegetary.setBounds(0, 0, vegetary.getIntrinsicWidth(), <yourHeight>);
    ssb.setSpan(new ImageSpan(vegetary, ImageSpan.ALIGN_BASELINE), ssb.length()-1, ssb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!