navasmdc / MaterialDesignLibrary

This is a library with components of Android L to you use in android 2.2
Apache License 2.0
8.99k stars 2.22k forks source link

Create a Button just with context #214

Open masmil1988 opened 9 years ago

masmil1988 commented 9 years ago

For almost all views it is possible to create them using the constructor with just the Context parameter. For the class Button it is not possible because of the row 37:

clickAfterRipple = attrs.getAttributeBooleanValue(MATERIALDESIGNXML,"animate", true);

Can you check at this row if attrs is null? This would allow us to create buttons programmatically...

RelativeLayout -> CustomView -> Button

in this queue only the Button class (and all its sons) has the problem because of the get on attrs. Its parents allow to create objects with attrs set to null

stealthcopter commented 9 years ago

+1 on this