protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final LinearLayout inLayout = (LinearLayout)findViewById(R.id.inLayout);
mAddButton = (Button)findViewById(R.id.Add_button);
mAddButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
final ImageView note = (ImageView) findViewById(R.id.note);
((ViewManager) note.getParent()).removeView(note);
inLayout.addView(note);
}
});
}
@Override
원래는
버튼 클릭했을 때 scrollview에 이미지를 띄우는 것 을 하고싶은데
일단 LinearLayout 에 띄우는 거 먼저 해봤습니다.
inLayout.addView(note)만 입력했을 때는
the specified child already has a parent addview 라는 오류가 뜨면서 다운되길래
구글링해서 ((ViewManager) note.getParent()).removeView(note);를 넣었더니
버튼을 눌러도 아무런 동작도 안합니다....
구글링해도 도저히 해결이 안되길래 이렇게 질문드립니다.