JoanZapata / android-iconify

Android integration of multiple icon providers such as FontAwesome, Entypo, Typicons,...
http://joanzapata.com/android-iconify
Other
3.93k stars 527 forks source link

IconButton no apply the Style. #142

Closed devinclava closed 8 years ago

devinclava commented 8 years ago

The IconButton don't apply the correct Style when use

stryle=@style/Widget.AppCompat.Button.Colored
JoanZapata commented 8 years ago

IconButton doesn't make any change to the style. What makes you think your style is not applied?

devinclava commented 8 years ago

When used with a normal button it take @color/colorAccent as background and white text (including additional styles).

When I used with IconButton it take white as background and black text color (and change other styles).

marabooy commented 8 years ago

Having the same issue too. has anyone found the solution?

luaz commented 8 years ago

Not sure if this is related, but whenever I try to write a new class and extend Button (e.g. IconButton), the new button (e.g. class IconButton) just look different from the standard button (class Button). So I assume this is not a android-iconify problem.

At the end, I write a function to put icon on standard button instead of using IconButton

public void iconify(TextView view, CharSequence text) {
    view.setTransformationMethod(null);
    view.setText(Iconify.compute(view.getContext(), text, view)); 
}
JoanZapata commented 8 years ago

As @luaz said this is not specific to Iconify. I guess the design library creates its own button when "Button" is encountered in XML, which is not compatible with a custom subclass. Applying Iconify programmatically to existing buttons is the way to go to be fully compatible with the design library, as suggested before.

view.setTransformationMethod(null);
view.setText(Iconify.compute(view.getContext(), text, view));