Question

i have two bitmap images ..and i need to merge the bitmaps with precise positioning of one bitmap over other and get a resultant bitmap (which is combination of both)

and the resultant bitmap is a font character and i want that bitmap to be displayed in a edit box where i am inputting text.

is it possible. Please help.

Était-ce utile?

La solution

Try using ImageSpan object, creating it with the result bitmap and attaching it to the relevant part of text in edit box. Something like this:

public class TestActivity extends Activity { 
@Override 
public void onCreate(Bundle savedInstanceState) { 
super.onCreate(savedInstanceState); 
setContentView(R.layout.main); 
        TextView textView  = (TextView) findViewById(R.id.textview); 
        SpannableString ss = new SpannableString("abc"); 
        Drawable d = getResources().getDrawable(R.drawable.icon32); 
        d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight()); 
        ImageSpan span = new ImageSpan(d, ImageSpan.ALIGN_BASELINE); 
        ss.setSpan(span, 0, 3, Spannable.SPAN_INCLUSIVE_EXCLUSIVE); 
        textView.setText(ss); 
 }
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top