안드로이드 개발 질문/답변
(글 수 45,052)
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
LinearLayout.LayoutParams llp = new LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.FILL_PARENT);
//(Inner Class)ImageView를 붙이기 위한 Layout 설정
imageview = new ImageView(this, attrs); // (Inner Class)ImageView 객체화
addContentView(imageview, llp);//ImageView를 Activity에 add
//이하 생략
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
imageHeight = image.getIntrinsicHeight();
imageWidth = image.getIntrinsicWidth();
image.setBounds(90,90,imageHeight,imageWidth);
image.draw(canvas);
super.onDraw(canvas);
this.invalidate();
}
위와 같이 imageview class 를 addContentView()해서 add 해서 canvas를 이용해 이미지를 좌표값에 나타내려고 합니다.
image.setBounds(90,90,imageHeight,imageWidth);
위에서 setBounds(x,y,width,height) 로 알고 있는데 x y 좌표가 그 좌표값에 나타나지않고 일정 위치에서 찌그러지는 현상이 나타납니다.
(첨부파일은 찌그러진 화면입니다.




right, bottom