Why nobody answer it?  I meet the same question. Have you resolved it?

Henrik Gustafsson wrote:
> Hi all!
>
> This was originally posted as a StackOverflow question (  
> http://stackoverflow.com/questions/549451
>   ), but following advice from #android I will also post the question
> here.
>
> I have two Android projects, a 'library project' containing a custom
> layout, and an 'application project' containing an application which
> uses the layout.
>
> Everything seems to build and execute fine, except that the visual
> layout editor throws a ClassNotFoundException (which I assume is a bug
> in the plug-in), but when I try to start to make use of the attributes
> I defined for the custom layout in the xml, the build fails. That is;
> this works:
>
>      <?xml version="1.0" encoding="utf-8"?>
>      <se.fnord.android.layout.PredicateLayout
>          xmlns:android="http://schemas.android.com/apk/res/android";
>          android:layout_width="fill_parent"
>          android:layout_height="fill_parent">
>        <TextView
>          android:layout_width="wrap_content"
>          android:layout_height="wrap_content"
>          android:text="asdfasdf"
>          />
>      </se.fnord.android.layout.PredicateLayout>
>
> Whereas this does not:
>
>      <?xml version="1.0" encoding="utf-8"?>
>      <se.fnord.android.layout.PredicateLayout
>          xmlns:android="http://schemas.android.com/apk/res/android";
>          xmlns:fnord="http://schemas.android.com/apk/res/se.fnord.android
> "
>          android:layout_width="fill_parent"
>          android:layout_height="fill_parent">
>        <TextView
>          fnord:layout_horizontalSpacing="1px"
>          android:layout_width="wrap_content"
>          android:layout_height="wrap_content"
>          android:text="asdfasdf"
>          />
>      </se.fnord.android.layout.PredicateLayout>
>
> The build fails with a message from aapt:
>
>      ERROR No resource identifier found for attribute
> 'layout_horizontalSpacing' in package 'se.fnord.android'
>
> The resource identifier does exist in the R-file and attrs.xml
> contained the library project, and if I put the layout code and
> resources directly in the application project everything works fine.
> The layout_horizontalSpacing attribute (and layout_verticalSpacing) is
> a custom attribute used in the PredicateLayout.LayoutParam class to
> specify the distance to the next widget.
>
> So far I've tried the standard eclipse ways by specifying project
> references and build path project dependencies. I was also told to try
> the <uses-library> tag in the application manifest, which did not help.
>
> So, what do I need to do for the references in the xml-file to work?
>
> I don't know if it's relevant, but the 'library' manifest looks like
> this:
>
>      <?xml version="1.0" encoding="utf-8"?>
>      <manifest xmlns:android="http://schemas.android.com/apk/res/
> android"
>            package="se.fnord.android"
>            android:versionCode="1" android:versionName="1.0.0">
>      </manifest>
>
> The 'application' manifest like this:
>
>      <?xml version="1.0" encoding="utf-8"?>
>      <manifest xmlns:android="http://schemas.android.com/apk/res/
> android"
>            package="se.fnord.appname"
>            android:versionCode="1" android:versionName="1.0.0">
>          <application android:icon="@drawable/icon"
> android:label="@string/app_name">
>              <activity android:name=".AppName"
>                        android:label="@string/app_name">
>                  <intent-filter>
>                      <action
> android:name="android.intent.action.MAIN" />
>                      <category
> android:name="android.intent.category.LAUNCHER" />
>                  </intent-filter>
>              </activity>
>          </application>
>      </manifest>
>
> 'se.fnord.android.layout.PredicateLayout', btw, is a cleaned-up
> version of the layout posted at http://stackoverflow.com/questions/549451
>   .
>
> Thanks!
>
> // Henrik
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to