Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding XML attributes for custom packages

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.

like image 301
user5243421 Avatar asked Jan 27 '13 06:01

user5243421


People also ask

How can we make attributes have multiple values in XML?

When we want to get information from the XML document stream into an attribute of the FME feature, and that information maps to an attribute with multiple values, then we can either: use a “primitive attribute” and append, with a separator character, the multiple values into one string, or.

What is the purpose of the Activity_main XML file in the project you created?

Choose as many answers as you see fit. What is the purpose of the activity_main. xml file in the project you created? It provides the theme settings for your app.

What is the main purpose of a ViewGroup?

What is the main purpose of a ViewGroup? - It groups together the most common views that developers use in Android apps. - It serves as a container for View objects, and is responsible for arranging the View objects within it. - It is required to make a view interactive as a way to group TextViews on a screen.


1 Answers

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

like image 117
Swati Avatar answered Oct 03 '22 00:10

Swati