Skip to main content

Posts

Showing posts from March, 2016

Custom TextView With Images in Android

Create a custom XML Tag with image and text 1) Class extends Textview import java . util . regex . Matcher ; import java . util . regex . Pattern ; import android . content . Context ; import android . text . Spannable ; import android . text . style . ImageSpan ; import android . util . AttributeSet ; import android . util . Log ; import android . widget . TextView ; public class TextViewWithImages extends TextView { public TextViewWithImages ( Context context , AttributeSet attrs , int defStyle ) { super ( context , attrs , defStyle ); } public TextViewWithImages ( Context context , AttributeSet attrs ) { super ( context , attrs ); } public TextViewWithImages ( Context context ) { super ( context ); } @Override public void setText ( CharSequence text , BufferType type ) { Spannable s = getTextWithImages ( getContext (), text ); super . setText...