0
main.xml
にカスタムImageView
を追加しようとしていますが、プログラムを開始すると強制終了して終了します。カスタムImageViewを追加した後に強制終了する
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:background="@drawable/background" >
<test.testpkg.CustomImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:src="@drawable/bg"/>
</LinearLayout>
Java
:また
package test.testpkg;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.widget.ImageView;
public class CustomImageView extends ImageView {
public CustomImageView(Context context) {
super(context);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
}
}
私はFCの後にデバッガでプログラムを起動する場合、私はこれを取得する:あなたが避難所ならば link text
2番目のコンストラクタが必要です。 – GeekYouUp
ええ、今それは動作している..奇妙なADTは、私は1つのパラメータではなく、2と一緒に含まれなければならないと言った。 – Martin
それはADTだった、それはEclipseだった。 – Cristian