안녕하세요. 왕초짜 개발자입니다. ㅜㅜ
다른게 아니고 뷰클래스를 만들어서 xml에 적용하여 사용할려고 하는데 자꾸 쏘리만 나오네요. ㅠㅠ
소스 검토 좀 부탁드리겠습니다. ㅜㅜㅜ
[Result] - 여기서 실행
public class Result extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main2);
}
}
[xml]
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="left"
>
<TextView
android:id="@+id/text1"
android:textSize = "20sp"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="111"/>
<com.android.licenseInfo.mCanvas
android:id="@+id/mcanvas"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:focusable="true"/>
</LinearLayout>
[mCanvas ] - 문제의 그 클래스 ㅠㅠ
public class mCanvas extends View{
public mCanvas(Context context) {
super(context);
}
@Override
protected void onDraw(Canvas canvas) {
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setTextSize(24);
paint.setColor(0xFF0000FF);
canvas.drawText("-_-;;", 0, 10 * 8, paint);
super.onDraw(canvas);
}
}
자문자답이네요 -_-
public mCanvas(Context context, AttributeSet attrs) {
super(context, attrs);
}
ㅠㅠㅠㅠㅠㅠ