Java Xml文件缺少属性

Java Xml文件缺少属性,java,android,Java,Android,我从这里导入了库: 然后,我创建了一个具有from和back id的xml文件: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wra

我从这里导入了库:

然后,我创建了一个具有from和back id的xml文件:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
             >

    <RelativeLayout 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/front"
            android:tag="front" >

            <ImageView
                android:id="@+id/ImageView01"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                 />

            <TextView
                android:id="@+id/TextView01"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBottom="@+id/ImageView01"
                android:layout_centerHorizontal="true"
                android:textSize="18sp"
                android:textStyle="bold"
                android:inputType="textMultiLine" />

        </RelativeLayout>


            <LinearLayout
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:orientation="horizontal"
                      android:id="@+id/back"
                     android:tag="back"

                      >

                      <Button
                          android:id="@+id/deleteBtn1"
                          android:layout_width="150dp"
                          android:layout_height="100dp"
                          android:text="Delete" />

                      <Button
                          android:id="@+id/UpdateBtn1"
                          android:layout_width="150dp"
                          android:layout_height="100dp"
                          android:text="Update" />

                  </LinearLayout>

</LinearLayout>
第121行是:

init(attrs);


public SwipeListView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(attrs);
    }

非常感谢Adir,我认为问题可能是您试图使用无效的包名标识符来实例化错误的类。main.java.com.fortysevendeg.android.swipelistview.swipelistview


从类名中删除main.java。

Adir我认为问题可能是您试图使用无效的包名标识符实例化错误的类。main.java.com.fortysevendeg.android.swipelistview.swipelistview


从类名中删除main.java。

谢谢,现在它不会显示此错误,非常感谢!但是我有一个nullPointerException,我不知道为什么…我在上面添加了我更新的xml和代码以及logcat,请帮助我,我现在有另一个问题,它显示了前布局和后布局,当我滑动listview时,它会同时滑动,并且仍然是一个空白条目,当再次滑动时,它会显示两个布局…你知道问题可能是什么吗?谢谢,现在它不会显示此错误,非常感谢!但是我有一个nullPointerException,我不知道为什么…我在上面添加了我更新的xml和代码以及logcat,请帮助我,我现在有另一个问题,它显示了前布局和后布局,当我滑动listview时,它会同时滑动,并且仍然是一个空白条目,当再次滑动时,它会显示两种布局…你知道问题可能是什么吗?
The following classes could not be instantiated:
- main.java.com.fortysevendeg.android.swipelistview.SwipeListView (Open Class, Show Error Log)
See the Error Log (Window > Show View) for more details.
Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse

java.lang.RuntimeException: Missed attribute swipeFrontView or swipeBackView
    at main.java.com.fortysevendeg.android.swipelistview.SwipeListView.init(SwipeListView.java:166)
    at main.java.com.fortysevendeg.android.swipelistview.SwipeListView.<init>(SwipeListView.java:121)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(    at sun.reflect.NativeConstructorAccessorImpl.newInstance(    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(    at java.lang.reflect.Constructor.newInstance(    at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.instantiateClass(ProjectCallback.java:422)
    at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(ProjectCallback.java:179)
    at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207)
    at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:135)
    at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:746)
    at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:718)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:372)
    throw new RuntimeException("Missed attribute swipeFrontView or swipeBackView");

 if (swipeFrontView == 0 || swipeBackView == 0) {
            throw new RuntimeException("Missed attribute swipeFrontView or swipeBackView");
        }
init(attrs);


public SwipeListView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(attrs);
    }