将TextView更改为ImageView

时间:2014-04-22 12:16:16

标签: android drag-and-drop textview imageview settext

在Drag&放弃活动,

我想拖动图像并将其放在TextView上。 并希望将文本视图更改为我已删除的图像视图。

 case DragEvent.ACTION_DROP:

            View view = (View) event.getLocalState();

            view.setVisibility(View.INVISIBLE);

            //This is the textView of the Traget
            TextView dropTarget = (TextView) dragView;

            //Possibly now the View would be an image View now,
            //view being dragged and dropped
            ImageView dropped = (ImageView) view;

            //Now here I want to set the textView of dropTarget as the ImageView of dropped, THIS I WANT TO UNDERSTAND TO HOW TO DO THIS
            dropTarget.setAnimation(dropped.getDrawable());


            break;

请帮助!!!!

1 个答案:

答案 0 :(得分:0)

您将使用TextView并将背景设置为textview,这对您有所帮助。