In TextView
I set drawableLeft
where the drawable
is showing from center. I need to align the drawableLeft
with top inside TextView
like this image.
Is it possible to achieve this?
Use SpannableString and ImageSpan to achieve this.
String msg=" "+"haii"; ImageSpan mImageSpan== new ImageSpan(mContext, R.drawable.icon); SpannableString text = new SpannableString(msg); text.setSpan(mImageSpan, 0, 1, 0); mTextView.setText(text);
the extra space in the string variable is replaced by the icon.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With