1
친구, Customview에서 레이아웃을 사용할 수 있습니까?
i는 사용자 정의 뷰 클래스public class Zoom extends View {
private Drawable image;
private int zoomControler=20;
public Zoom(Context context)
{
super(context);
image=context.getResources().getDrawable(R.drawable.icon);
setFocusable(true);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
//TransparentPanel tp = new TransparentPanel(this.getContext());
//Button MyButton = new Button(this.getContext());
//MyButton.setText("Press me");
//tp.addView(MyButton);
image.setBounds((getWidth()/2)-zoomControler, (getHeight()/2)-zoomControler, (getWidth()/2)+zoomControler, (getHeight()/2)+zoomControler);
image.draw(canvas);
}
}
내가 그 디자인을 표시하려면이 사용자 정의보기에 된 setContentView (R.layout.mylayout)를 사용할 수 있나요?
또는
어떻게 코드를 주석 것처럼 제가 방법의 onDraw 이미지 버튼을 표시 할 수 있는가?
어떤 도움을 주시면 감사하겠습니다. 이 경우