안드로이드 개발 질문/답변
(글 수 45,052)
안녕하세요..
궁금한점이 있어 이렇게 글을 올립니다..
우선 LayoutInflater를 사용해서 View를 추가 했습니다..
tag를 추가하고 클릭했을때 view를 얻는방법은 알고 있습니다..
(아래 그림처럼요..)
for(int a=0; a<10; a++) { LayoutInflater inflater = LayoutInflater.from(this); RelativeLayout zzz = (RelativeLayout)inflater.inflate(R.layout.zzz, null); ImageView iv = (ImageView)zzz.findViewById(R.id.bg); iv.setBackgroundResource(R.drawable.bg001 + a);
TextView tv = (TextView)pae.findViewById(R.id.text);
tv.setText(Integer.toString(a));
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(Size, Size); lp.setMargins(nLBaseMargin + nLMargin, nTBaseMargin + nTMargin, 0, 0); zzz.setLayoutParams(lp); zzz.setTag(a); zzz.setOnClickListener(this); ((RelativeLayout)findViewById(R.id.area)).addView(zzz); }
궁금한점은요 View를 얻는 자동 이벤트가 없는 상황에서 어떻게 view를 얻는지 궁금합니다..
제가 하고자 하는 부분은 위에서 만든 10개의 그림zzz(imageview + textview)들을 특정 액션 이벤트없이 얻어 핸들링 하고자 합니다.
고수분들의 지도편달 부탁드립니다..
((RelativeLayout)findViewById(R.id.부모뷰)).getchild(index)로 알수 있군요..;;
제가 질문하고 제가 답하네요..;;