1: LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
2: RelativeLayout relativeLayout = (RelativeLayout)inflater.inflate(R.layout.relativelayoutmain, null);
3: LinearLayout newLayout = new LinearLayout(this);
4: newLayout.setOrientation(LinearLayout.VERTICAL);
5: newLayout.setBackgroundColor(Color.DKGRAY);
6: Button button = new Button(this);
안녕하세요. 추락천사입니다.
아주 초보적인 질문을 하려고 합니다. 인터넷을 아무리 뒤져도, 도통 답이 안나오네요.
[질문]
3번째 line 에서 LinearLayout(this) 에서 도대체 왜 (this) 가 나온건지 이해가 잘 안되네요.
제가 생각하는 일반적인 this 는 멤버변수,객체를 지칭할 때 쓰는건데 왜 여기서 나온건지...
또한
" newLayout 에 상대 레이아웃 R.layout.relativelayoutmain 리소스에서 가져온 RelativeLayout 객체를 삽입하고 앞으로 만들 새로운 버튼 객체를 추가할 것이다. "
이라고 하는데, 이것 또한 잘 이해가 가질 않아서요. ㅡㅜ...