gpt4 book ai didi

java - 无法在 Android Activity 布局 XML 文件中实例化自定义类

转载 作者:行者123 更新时间:2023-12-02 07:08:51 26 4
gpt4 key购买 nike

所以我的 XML 看起来像这样:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".Calendar" >

<com.fortysevendeg.android.swipelistview.SwipeListView
xmlns:swipe="http://schemas.android.com/apk/res-auto"
android:id="@+id/example_lv_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:listSelector="#00000000"
swipe:swipeActionLeft="reveal"
swipe:swipeActionRight="reveal"
swipe:swipeAnimationTime="10"
swipe:swipeBackView="@+id/back"
swipe:swipeCloseAllItemsWhenMoveList="true"
swipe:swipeFrontView="@+id/front"
swipe:swipeMode="right"
swipe:swipeOffsetLeft="80dip"
swipe:swipeOffsetRight="80dip"
swipe:swipeOpenOnLongPress="false" />

</RelativeLayout>

但是,当我进入 Eclipse 中的图形 View 时,出现此错误:

The following classes could not be found: - com.fortysevendeg.android.swipelistview.SwipeListView (Fix Build Path, Edit XML, Create Class)

在 Eclipse 中,我的 Package Explorer 窗口中有 3 个包。

  • android-swipelistview-master
  • 我的应用程序
  • 库(android-swipelistview-master 的依赖项)

看起来像这样:SCREENSHOT

奇怪的是,我在 android-swipelist-view-master 和库包中都没有任何错误。唯一的警告是针对未使用的变量,我犹豫是否删除它,以防它在其他地方使用。我想我只是没有正确实例化它?我不知道。我想不通这个!

Here是 myApp 包属性 > Android 设置。

最佳答案

正确引用所有库后,我更改了 XML 以引用 SwipeListView,如下所示:

<main.java.com.fortysevendeg.android.swipelistview.SwipeListView
xmlns:swipe="http://schemas.android.com/apk/res-auto"
android:id="@+id/example_lv_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:listSelector="#00000000"
swipe:swipeActionLeft="reveal"
swipe:swipeActionRight="reveal"
swipe:swipeAnimationTime="10"
swipe:swipeBackView="@+id/back"
swipe:swipeCloseAllItemsWhenMoveList="true"
swipe:swipeFrontView="@+id/front"
swipe:swipeMode="right"
swipe:swipeOffsetLeft="80dip"
swipe:swipeOffsetRight="80dip"
swipe:swipeOpenOnLongPress="false" />

关于java - 无法在 Android Activity 布局 XML 文件中实例化自定义类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15778013/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com