Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflicting attribute names with AppCompat library #41

Closed
wants to merge 1 commit into from

Conversation

eeVoskos
Copy link

Intro

There is an inherent problem in declaring styleable attributes on Android: you may end up with conflicting attribute names when you use multiple library projects that declare custom attributes.

Problem

In PagerSlidingTabStrip there are some attribute names that conflict with ones that exist in the AppCompat library project, which is part of the official android support library. Namely, the two attributes affected are:

  • dividerPadding
  • textAllCaps

The problem is that currently you cannot include in your project both PagerSlidingTabStrip and AppCompat, as your project won't build. The error log on Eclipse is the following:

.../PagerSlidingTabStrip/library/res/values/attrs.xml:10: error: Attribute "dividerPadding" has already been defined
.../PagerSlidingTabStrip/library/res/values/attrs.xml:15: error: Attribute "textAllCaps" has already been defined

Solution

The suggested solution in such cases is to put a prefix to all attributes in third party libraries, so that conflicts are avoided. An easier solution would be to simply change the names of the two affected attributes, but for consistency purposes I created this pull request that prefixes all declared attributes in PagerSlidingTabStrip with the word strip.

Result

You are able to use both PagerSlidingTabStrip and AppCompat in your project, along with any other android library projects. Happy :-)

@pierrre
Copy link

pierrre commented Dec 6, 2013

+1 this library is unusable currently :(

@ghost
Copy link

ghost commented Dec 13, 2013

Fixed this in 1.0.1 by using psts prefix for all attributes

@astuetz astuetz closed this Dec 13, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants