gaugeView.java
public class gaugeView extends View{
public gaugeView(Context context) {
super(context);
}
}
start.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center">
<guageView
android:id="@+id/gaugeView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
될거 같은데 왜 안될 까요? 도움좀 주시면 감사하겠습니다.
초보 개발자님 말씀 대로 해결 되었습니다.
xml 에서 뷰생성시 3가지 생성자 메소드 중
public gaugeView(Context context, AttributeSet attrs)
메소드를 써주니 해결 되었습니다.
아무래도 AttributeSet attrs 파라메터가 필요 했나 봅니다.
public class gaugeView extends View {
}
public gaugeView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void onDraw(Canvas canvas){
canvas.drawColor(Color.RED);
}
}