膨胀自定义视图android问题

我已将视图扩展到ScrollImageView。然后我把它放入xml: 在main.xml中:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="wrap_content" android:layout_width="wrap_content"
    android:orientation="vertical">
    <TextView android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:text="@string/hello" />

    <TextView android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:id="@+id/my_xml" />

    <com.Android.Maps03.ScrollImageView
        android:id="@+id/BaseView" android:layout_width="fill_parent"
        android:layout_height="fill_parent" />



</RelativeLayout>
然后我想在主要活动中使用它,如下所示:
 public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.main);
        ScrollImageView sIV = (ScrollImageView)findViewById(R.id.BaseView);
        Bitmap markerImage = BitmapFactory.decodeResource(this.getResources(), R.drawable.mapbase );
        sIV.setImage(markerImage);
当我运行应用程序时,ScrollImage不会出现。 clase(ScrollImageView)的构造函数是这样的:
public ScrollImageView(Context context, AttributeSet attributeSet) {
    super(context);
    initScrollImageView(context);

private void initScrollImageView(Context context) {
    mDisplay = ((WindowManager)context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
    mPadding = DEFAULT_PADDING;
}
你有想法吗? 谢谢。 评论#1是的,我忘记了,但我有同样的问题。 评论#2不,我用第二个/>关闭所有布局,而不是关闭两次 评论#3这是新的logcat,我认为这是最值得注意的条目。 Plz帮助!     
已邀请:
您没有在Activity onCreate中调用setContentView     

要回复问题请先登录注册