BoD/android-switch-backport — pull request #46 by t-animal (2014-05-01 19:55:51+00:00)
Title: Fix width calculations and allow text to be directly set

The second commit (2e03447) allows text to be set directly like this:

````

````

The first commit (bb9d2e4) fixes an issue I encountered with the width of the switches:
Before: https://drive.google.com/file/d/0B31lfDnpvbZPT0J3TmhDWDBnZlE/edit?usp=sharing
After: https://drive.google.com/file/d/0B31lfDnpvbZPTTFvMUtQZWJqQjA/edit?usp=sharing

They are set to layout_width="wrap_content" and are within a table view. As you can see the width is only about half that of the (widest) switch. The others are partly visible because table columns grow to the size of the widest content. You can also see that there still seem to be issues, because the width of the underlying lines does not grow with them (they are Views that should grow with the content of the column), but it's a lot better already.

Now, I'm still very new to android so I don't know if it's clever to keep the state bits of getMeasuredWidthAndState() and also my project has to be finished soon so I can't read up on it, but I'd like to share this fix with you, hoping you can use it somehow.