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.

有帮助吗?

解决方案

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); 
 }
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top