2

I'm trying to use this ViewPager extension. This plugin helps me using SwipeyTab. I succeed to run example as a single application. So I want to integrate extension in to my application.Then I coppied the java files and changed package names, everything is fine. But I've got some errors on these lines:

mTextColorCenter = a.getColor(R.styleable.ViewPagerExtensions_textColorSelected, mTextColorCenter);
mLineColorCenter = a.getColor(R.styleable.ViewPagerExtensions_lineColorSelected, mLineColorCenter);
mLineHeightSelected = a.getDimensionPixelSize(R.styleable.ViewPagerExtensions_lineHeightSelected, mLineHeightSelected);

Eclipse says: Styleable cannot be resolved or is not a field. Other lines which contains styleable also gives the same errors too. If I try to click solve this problem nothing changes.

When I have looked at extension's R.java file, I saw these lines:

public static final class styleable {
    public static final int[] ViewPagerExtensions = {
        0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003,
        0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007,
        0x7f010008, 0x7f010009, 0x7f01000a
    };

    public static final int ViewPagerExtensions_dividerColor = 7;

    // there is more 
}

I know it's not possible to edit R.java. How could I define styleable in R.java for this extension? Any suggestions?

hasanghaforian
  • 13,858
  • 11
  • 76
  • 167
Martin
  • 441
  • 3
  • 16

1 Answers1

2

You should define, attributes that you gonna need, in a seperate xml file. I mean create a values.xml and use <declare-styleable name="ViewPagerExtensions"></declare-styleable> tags.

Let me give an example:

<declare-styleable name="ViewPagerExtensions">
    <attr format="integer" name="dividerColor" />
</declare-styleable>

By the way, there is already attrs.xml in project, check it out:

Ogulcan Orhan
  • 5,170
  • 6
  • 33
  • 49