0
동적으로 생성 한 탭이 있는데, 그 다음에 드롭 다운 컨트롤러 n
드롭 다운으로 GridView를 프로그래밍 방식으로 추가합니다. 하나의 탭만 있으면 모두 작동하지만 두 번째 탭으로 스크롤하여 항목을 다시 정렬 한 다음 다시 이동하면 충돌이 발생합니다. 두 개의 탭 모두 동일한 mDragController를 사용하기 때문에이 태그를 믿습니다. 별도의 컨트롤러를 사용하는 방법을 수정하는 것이 매우 쉽습니다.동적으로 생성 된 GridView에서 끌어서 놓기
private DragController mDragController;
private boolean mLongClickStartsDrag = true; // If true, it takes a long click
protected void onCreate(Bundle savedInstanceState) {
...
final TabHost Tabs = (TabHost) findViewById(android.R.id.tabhost);
Tabs.setup();
int count;
for (count =0;count < 2;count++){
...
final int passedTabId = count;
NewTab.setContent(new TabHost.TabContentFactory()
{
public View createTabContent(String tag)
{
...
GridView dynGrid = new GridView(ManageRooms.this);
...
mDragController = new DragController (ManageRooms.this);
dynGrid.setAdapter (new ImageCellAdapter (ManageRooms.this, mDragController));
layout.addView(dynGrid);
return layout;
}
});
Tabs.addTab(NewTab);
}
}
public boolean startDrag (View v) {
v.setOnDragListener (mDragController);
mDragController.startDrag (v);
return true;
}
}
님이 질문에 답하십시오 [link] (http://stackoverflow.com/questions/20988505/open-child-act-bin-host-android) –