Friday, September 28, 2012

No resource identifier found for attribute 'indicator_gravity' in package ….

I was trying to porting the Tree-View-List-Android into my project recently. I have created a project called com.dotnetideas.treeview and added everything in. I can run the demo without any issue. But when I use it in another project, I kept getting “No resource identifier found for attribute 'indicator_gravity' in package com.dotnetideas.treeview” in main_demo.xml.
Here is the xml looks like.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:treeView="http://schemas.android.com/apk/res/com.dotnetideas.treeview"
  android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent">
  <ListView android:layout_width="0dip" android:layout_height="0dip" android:scrollbars="vertical"
    android:visibility="gone"> <!-- Just to test some attributes in IDE -->
  </ListView>
  <pl.polidea.treeview.TreeViewList android:id="@+id/mainTreeView" android:layout_width="fill_parent"
    android:layout_height="fill_parent" treeView:indicator_gravity="right|center_vertical"
    android:scrollbars="vertical" android:smoothScrollbar="true"/>
</LinearLayout>
Although I followed the old code to changed the xml namespace from xmlns:treeView=http://schemas.android.com/apk/res/pl.polidea.treeview to xmlns:treeView=http://schemas.android.com/apk/res/com.dotnetideas.treeview. It doesn’t seem like valid xml namespace. It turned out that the namespace needs to be xmlns:treeView="http://schemas.android.com/apk/res-auto" if we reference as a library project.

1 comment: