【问题标题】:Change a TextView to an ImageView将 TextView 更改为 ImageView
【发布时间】:2014-04-22 12:16:16
【问题描述】:

在拖放活动中,

我想将图像拖放到 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;

请帮忙!!!!

【问题讨论】:

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


    【解决方案1】:

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

    【讨论】:

    • 感谢您的回复。但我无法将要拖动的图像设置为“.setbackgroud”,因为它的参数是背景或 Rsid
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-05
    • 1970-01-01
    • 1970-01-01
    • 2011-11-02
    • 1970-01-01
    相关资源
    最近更新 更多