MDP
MDP

Reputation: 4267

How to set a style when using a view from imported library

I'm using this library to obtain round images. I want to create a style to control the CircularImageView view.

 <style name="vircularImageView" >
        <item name="android:layout_width">@dimen/cardViewImagesize</item>
        <item name="android:layout_height">@dimen/cardViewImagesize</item>
        <item name="app:civ_border_color">#000000</item>
 </style>

The problem is the item app:civ_border_color, that gives me an error when compiling.

The attribute civ_border_color is specific for this object com.mikhaellopez.circularimageview.CircularImageView, so i'm wondering how to solve the problem.

I tried using parent but I dont' get any suggestion that matches CircularImageView.

Thank you

How can

Upvotes: 0

Views: 81

Answers (2)

romtsn
romtsn

Reputation: 11982

Well, in styles you should not use any prefix for custom attributes, so it should be:

<style name="vircularImageView" >
    <item name="android:layout_width">@dimen/cardViewImagesize</item>
    <item name="android:layout_height">@dimen/cardViewImagesize</item>
    <item name="civ_border_color">#000000</item>
</style>

Upvotes: 2

Andy Developer
Andy Developer

Reputation: 3101

Why don't you try this instead of using a big library.

RoundedBitmapDrawable roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(Activity.this.getResources(), yourbitmap);
roundedBitmapDrawable.setCircular(true);
your_imageview.setImageDrawable(roundedBitmapDrawable);

Upvotes: 1

Related Questions