LayoutInflater und DragShadow

  • 0 Antworten
  • Letztes Antwortdatum
J

Jman

Neues Mitglied
0
Hallo!

Ich würde für eine Drag & Drop Operation gerne ein View verwenden, welches in einer XML Datei definiert ist. Dazu mache ich folgendes

Code:
    private final class MyLongClickListener implements OnLongClickListener {
    	  public boolean onLongClick(View v) {   	   
    	   ...   
    	   // build the shadow when dragging
    	   TextView tmp = (TextView) LayoutInflater.from(getBaseContext()).inflate(R.layout.room_layout, null);
    	   tmp.setText(((TextView) v).getText());
    	   DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(tmp);    	   
    	   
    	   v.startDrag(dragData, 
    			   	   shadowBuilder,  
    			   	   null, 
    	               0);    
    	   
    	   return true;
    	  }	
    }

wobei room_layout wie folgt aussieht:
Code:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" 
    android:textSize="15sp"
    android:textStyle="bold"
    android:textColor="#FFFFFF"
    android:gravity="center"
/>


Wenn ich jetzt aber ein etwas per Drag and Drop bewege, sehe ich keinen Shadow. Woran könnte das liegen?
 
Zurück
Oben Unten