Hi all,
  I'm developing an android application which has a custom view with some 
custom xml attributes. The attributes are defined in res/values/attrs.xml, 
like:

<resources>
  <declare-styleable name="CustomView">
    <attr name="custom_attr" />
  </declare-styleable>
<resources>

And in CustomView.java, the attributes are loaded with TypedArray, like:

public class CustomView extends View {

    public CustomView(Context context, AttributeSet attrs) {
        TypedArray a = context.obtainStyledAttributes(attrs, 
R.styleable.CustomView);
        ...;
        a.recycle();
}

This CustomView works correctly in the main apk.

Then I want to write an instrumentation test to test this CustomView, so I 
write a test layout file, which looks like:

tests/res/layout/test-layout.xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
    
xmlns:myapp="http://schemas.android.com/apk/res/com.<http://schemas.android.com/apk/res/com.google.android.apps.myapp>mycompany.myapp"
 
>

    <com.google.android.apps.myapp.CustomView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      myapp:custom_attr="xxxx" />

</LinearLayout>

But Eclipse always complains: No resource identifier found for attribute 
'custom_attr' in package 'com.mycompany.myapp'.

Anybody know how to fix this problem?

Best Regards
James Su

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to