안드로이드 개발 질문/답변
(글 수 45,052)
ScratchView sv = new ScratchView(this);
LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
lp.setMargins(10, 10, 10, 10);
RelativeLayout rl = (RelativeLayout) findViewById(R.id.img_where1);
rl.addView(sv, lp);
RelativeLayout r2 = (RelativeLayout) findViewById(R.id.img_where2);
r2.addView(sv, lp);
RelativeLayout r3 = (RelativeLayout) findViewById(R.id.img_where3);
r3.addView(sv, lp);
이런식으로 할려고 하는데 1개 할때는 되는데 2개 이상 가면 에러가 뜨더라구요 혹시 방법이 있을까요?
이건 방법 자체가 잘못된거 같은데요
A라는 뷰를 하나 만들고 이뷰를 세곳에다가 사용하는건 원래 안되는 방법입니다.
A라는 뷰를 세개 만들고 각각 add하는 방식으로 하셔야 할듯...
그리고 위에 내용은 상속의 개념이 아닌거 같은데요? ㅎㅎ;;