개발/개발 자료

(Android) RelativeLayout 코드로 구현하기

시원한물냉 2014. 3. 26. 10:57
//
RelativeLayout mView = (RelativeLayout)findViewById(R.id.gview);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(WIDTH, HEIGHT);
         
params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
//
위와같이 사용하여서 RelativeLayout 를 선언하고 처리할 수 있다.
순수한 코딩에서 할때에는 위에 
RelativeLayout mView = (RelativeLayout)findViewById(R.id.gview);

대신에

RelativeLayout mView = new RelativeLayout (this);
사용하면 된다는거 아시죠?