Understanding XML attributes for custom packages
Asked Answered
A

1

11

I'm trying to use the drag/drop functionality from this fine project: https://github.com/bauerca/drag-sort-listview/

First, I've added the library using the instructions on GitHub.

Second, I'm trying to use the XML declaration. This is my 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>

But, Eclipse is throwing this error: No resource identifier found for attribute 'drag_enabled' in package 'com.mobeta.android.dslv'; similarly for 'drag_scroll_start' and 'drag_start_mode'.

I'd like to understand on a more general level what I'm doing wrong here. And if anyone can give me specific help for using this library, I'd appreciate that as well.

Alarmist answered 27/1, 2013 at 6:7 Comment(2)
Should work, nevertheless, Try copying this file to your /res/values.Euchromosome
Have added all the XML attributes listed in the github ?Wight
S
24

Since you are refering the attributes fro your library instead of giving the full path of the library give "res-auto" please see the change

<?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

Sheldonshelduck answered 27/1, 2013 at 6:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.