image - drag and drop different buttons into a view (Android)? -


need drop different buttons view in creating clip art palette. added image want background of button. tried out code , works well, problem drops same image every button click. code

    layout = (framelayout) findviewbyid(r.id.linearlayout01);     // layout.setontouchlistener(this);      btn = (button) findviewbyid(r.id.btn);     btn.setdrawingcacheenabled(true);     btn.setontouchlistener(this);      btn2 = (button) findviewbyid(r.id.btn2);     btn2.setdrawingcacheenabled(true);     btn2.setontouchlistener(this);      btn3 = (button) findviewbyid(r.id.btn3);     btn3.setdrawingcacheenabled(true);     btn3.setontouchlistener(this);       btn4 = (button) findviewbyid(r.id.btn4);     btn4.setdrawingcacheenabled(true);     btn4.setontouchlistener(this);       params = new layoutparams(layoutparams.wrap_content,             layoutparams.wrap_content);       }   @override public boolean ontouch(view view, motionevent me) {              if (me.getaction() == motionevent.action_down) {         status = start_dragging;         image = new imageview(this);         image.setimagebitmap(btn.getdrawingcache());         layout.addview(image, params);      }     if (me.getaction() == motionevent.action_up) {         status = stop_dragging;         log.i("drag", "stopped dragging");     } else if (me.getaction() == motionevent.action_move) {         if (status == start_dragging) {             system.out.println("dragging");             image.setpadding((int) me.getrawx(), (int) me.getrawy(), 0, 0);             image.invalidate();         }     }             return false; }   


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -