public class Android_OnLyaoutActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CustomLayout layout=new CustomLayout(this);
TextView v=new TextView(this);
v.setText("ddd");
v.setLayoutParams(new CustomLayout.LayoutParams(100, 100, 10, 10));
layout.addView(v);
setContentView(layout);
}
public static class CustomLayout extends ViewGroup{
public CustomLayout(Context context) {
super(context);
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
// TODO Auto-generated method stub
int i=getChildCount();
View v1 = getChildAt(i);//현재 제일뒤, 즉 지금생성한 것?
b=v1.getLayoutParams().height;
r=v1.getLayoutParams().width;
v1.layout(l, t, r, b);
}
public static class LayoutParams extends ViewGroup.LayoutParams{
public int x,y;
public LayoutParams(int width,int height,int x1,int y1){
super(width,height);
x=x1;
y=y1;
}
}
}
}
http://javaexpert.tistory.com/307<<여기있는 것을 따라하다가 막혔는데요..
위치 정보를 어떻게 받고, final void layout은 대체 어디에다가 생성해야 하는 것인가요?
정확히 이해가 안가네요.. 이게 맞는 설명인지도 긴가민가하고요
부탁드려요 좀 더 풀어서 설명해주실분 찾습니다.Please



