android - 了解自定义包的 XML 属性

标签 android android-xml android-2.1-eclair

我正在尝试使用这个优秀项目的拖放功能:https://github.com/bauerca/drag-sort-listview/

首先,我使用 the instructions on GitHub 添加了库.

其次,我正在尝试使用 the XML declaration .这是我的 main.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:dslv="http://schemas.android.com/apk/res/com.mobeta.android.dslv"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <include layout="@layout/header"/>

    <com.mobeta.android.dslv.DragSortListView
        android:id="@+id/list"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:divider="#D9D9D9"
        android:dividerHeight="2dp"
        android:listSelector="@drawable/list_selector"
        dslv:drag_enabled="true"
        dslv:drag_scroll_start="0.33"
        dslv:drag_start_mode="onDown"/>
</LinearLayout>

但是,Eclipse 抛出此错误:No resource identifier found for attribute 'drag_enabled' in package 'com.mobeta.android.dslv'; 'drag_scroll_start''drag_start_mode'

我想在更一般的层面上了解我在这里做错了什么。如果有人可以为我提供使用该库的具体帮助,我也将不胜感激。

最佳答案

因为你引用的是你的库的属性,而不是给出库的完整路径,所以给出“res-auto” 请看变化

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:dslv="http://schemas.android.com/apk/res-auto"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical" >

<include layout="@layout/header"/>

<com.mobeta.android.dslv.DragSortListView
    android:id="@+id/list"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:divider="#D9D9D9"
    android:dividerHeight="2dp"
    android:listSelector="@drawable/list_selector"
    dslv:drag_enabled="true"
    dslv:drag_scroll_start="0.33"
    dslv:drag_start_mode="onDown"/>

for reference

关于android - 了解自定义包的 XML 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14544926/

相关文章:

android - 在 Android Phonegap Build 中集成广告

android - 如何去除 NavigationView 下方的阴影?

android如何在按钮之间留出一些空间并在每个按钮上方制作白线

安卓; getApplication() 返回 null,不明白为什么

android - MotionEvent 多个触摸事件混淆并相互影响(参见演示视频)

android - 以编程方式设置 CardView 海拔

android - Flex Air For Android 中的透明背景?

Android : Difference between View. GONE 和 View.INVISIBLE?

android - 填充在某些设备上不起作用

java - Android Market 错误 -17 和缺少但可用的相机 : Has anyone else encountered this and what can be done?