Relationship between res and package in Android studio
I got a error message like this:
Gradle: No resource identifier found for attribute 'dividerColor' in
package 'com.astuetz.viewpager.extensions.example'
When I'm trying to merge the source code from a library and example. Here
is the folder structure of the source code:
Here are what I did:
Copy all the example code to com/astuetz/viewpager/extensions/example
folder. The package is com.astuetz.viewpager.extensions.example.
Copy all the library source code into com/astuetz/viewpager/extensions/
because its package name is com.astuetz.viewpager.extensions.
Copy the res of example and library into res folder.
Here is the AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<uses-sdk android:minSdkVersion="4" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<activity
android:label="@string/app_name"
android:name="com.astuetz.viewpager.extensions.example.MainActivity"
>
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:label="@string/app_name"
android:name="com.astuetz.viewpager.extensions.example.PagerActivity"
>
</activity>
</application>
Here is the res/values/attrs.xml which is from the library.
<?xml version="1.0" encoding="utf-8"?>
<declare-styleable name="ViewPagerExtensions">
<attr format="integer" name="fadeOutDelay" />
<attr format="integer" name="fadeOutDuration" />
<attr format="color" name="textColorSelected" />
<attr format="color" name="lineColor" />
<attr format="color" name="lineColorSelected" />
<attr format="dimension" name="lineHeight" />
<attr format="dimension" name="lineHeightSelected" />
<attr format="color" name="dividerColor" />
<attr format="dimension" name="dividerMarginTop" />
<attr format="dimension" name="dividerMarginBottom" />
<attr format="reference" name="dividerDrawable" />
<attr format="dimension" name="outsideOffset" />
</declare-styleable>
But I always got the error message I mentioned above. This confused me
because I set the package to com.astuetz.viewpager.extensions. Why it
always look for res in com.astuetz.viewpager.extensions.example?
Can anybody advise? Thanks
No comments:
Post a Comment