1gravity / Android-ContactPicker

A beautifully designed component to pick one or several contacts (including groups) from the Android contacts list
Apache License 2.0
66 stars 33 forks source link

While settings my own AppTheme I got an exception... #22

Closed mudassirzulfiqar closed 7 years ago

mudassirzulfiqar commented 7 years ago

Attribute undefined. cp_TextColorPrimary Did you apply to correct theme.

I want to set the AppTheme which is my default App theme.

.putExtra(ContactPickerActivity.EXTRA_THEME, R.style.AppTheme)

I have read that /**

What are other attributes that I need to set.

1gravity commented 7 years ago

All the attributes defined in the Android-ContactPicker/library/src/main/res/values/attrs.xml file. You could just copy the style definition from the demo app.

mudassirzulfiqar commented 7 years ago

I have copied this style theme. It is still giving an error.

<style name="Theme_Light_Base" parent="@style/ContactPicker_Theme_Light">
    <!-- ActionBarCompat -->
    <item name="colorPrimary">@color/colorPrimary_light</item>
    <item name="colorAccent">@color/colorAccent_light</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark_light</item>

    <item name="backgroundColor">@color/background_light</item>
    <item name="icTheme">@drawable/ic_palette_black_36dp</item>
    <item name="icPickContact">@drawable/ic_person_add_black_36dp</item>
</style>

<style name="Theme_Light" parent="@style/Theme_Light_Base"/>

error: Error:(2442, 21) No resource found that matches the given name: attr 'backgroundColor'. Error:(2444, 21) No resource found that matches the given name: attr 'icPickContact'. Error:(2443, 21) No resource found that matches the given name: attr 'icTheme'. Error:(2442, 21) No resource found that matches the given name: attr 'backgroundColor'. Error:(2444, 21) No resource found that matches the given name: attr 'icPickContact'. Error:(2443, 21) No resource found that matches the given name: attr 'icTheme'.

1gravity commented 7 years ago

backgroundColor, icPickContact and icTheme are your own custom attributes and have nothing to do with the library. Please read this to solve your compile issues: https://developer.android.com/guide/topics/ui/themes.html.

1gravity commented 7 years ago

There was a typo in one the the style definitions, try the new version 1.3.2