bod / android-switch-backport Goto Github PK
View Code? Open in Web Editor NEWA backport of the SwitchPreference component that was introduced on Android 4 (ICS / level 14). This port works on Android 2.1+ (Eclair MR1 / level 7).
A backport of the SwitchPreference component that was introduced on Android 4 (ICS / level 14). This port works on Android 2.1+ (Eclair MR1 / level 7).
In Support Library >= 21 Widget.AppCompat.CompoundButton.Switch
provides material theming for SwitchCompat
. Unfortunately, it does not work as drop-in replacement for Widget.Holo.CompoundButton.Switch
if used as value for asb_switchStyle
: application crashes with NullPointerException:
at org.jraf.android.backport.switchwidget.Switch.onMeasure(Unknown Source)
at android.view.View.measure(View.java:16772)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5139)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
at android.view.View.measure(View.java:16772)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5139)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:1052)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:590)
at android.view.View.measure(View.java:16772)
at android.widget.ListView.setupChild(ListView.java:1870)
at android.widget.ListView.makeAndAddView(ListView.java:1793)
at android.widget.ListView.fillDown(ListView.java:691)
at android.widget.ListView.fillFromTop(ListView.java:752)
at android.widget.ListView.layoutChildren(ListView.java:1630)
at android.widget.AbsListView.onLayout(AbsListView.java:2136)
at android.view.View.layout(View.java:15092)
at android.view.ViewGroup.layout(ViewGroup.java:4645)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:15092)
at android.view.ViewGroup.layout(ViewGroup.java:4645)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1660)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1436)
at android.view.View.layout(View.java:15092)
at android.view.ViewGroup.layout(ViewGroup.java:4645)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:15092)
at android.view.ViewGroup.layout(ViewGroup.java:4645)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:15092)
at android.view.ViewGroup.layout(ViewGroup.java:4645)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:15092)
at android.view.ViewGroup.layout(ViewGroup.java:4645)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:15092)
at android.view.ViewGroup.layout(ViewGroup.java:4645)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2014)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1771)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1026)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5776)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:771)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:544)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:757)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:149)
at android.app.ActivityThread.main(ActivityThread.java:5268)
Hi.
My project should run on 2.3.3+ devices, all the way up to and including JB. I have added your library to get the nice looking Switch control and it works nicely. The only issue I have is that on my JB device, the look of the Switch is not quite right; the "thumb" is a rectangle instead of having slanted sides; it is perfectly functional but on 2.3.3, it looks like the standard ICS Switch but on post ICS, it doesn't.
How should I do the theme so that it works nicely on pre and post ICS?
Thanks for writing this library,
Ali.
11-20 14:19:04.128: E/AndroidRuntime(10332): FATAL EXCEPTION: main
11-20 14:19:04.128: E/AndroidRuntime(10332): java.lang.NullPointerException
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.text.Layout.getDesiredWidth(Layout.java:67)
11-20 14:19:04.128: E/AndroidRuntime(10332): at org.jraf.android.backport.switchwidget.Switch.makeLayout(Switch.java:378)
11-20 14:19:04.128: E/AndroidRuntime(10332): at org.jraf.android.backport.switchwidget.Switch.onMeasure(Switch.java:306)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.view.View.measure(View.java:15172)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:617)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:399)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.view.View.measure(View.java:15172)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.view.View.measure(View.java:15172)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1390)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.widget.LinearLayout.measureVertical(LinearLayout.java:681)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.widget.LinearLayout.onMeasure(LinearLayout.java:574)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.view.View.measure(View.java:15172)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
11-20 14:19:04.128: E/AndroidRuntime(10332): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2148)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.view.View.measure(View.java:15172)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1850)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1102)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1275)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4214)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.view.Choreographer.doCallbacks(Choreographer.java:555)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.view.Choreographer.doFrame(Choreographer.java:525)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.os.Handler.handleCallback(Handler.java:615)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.os.Handler.dispatchMessage(Handler.java:92)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.os.Looper.loop(Looper.java:137)
11-20 14:19:04.128: E/AndroidRuntime(10332): at android.app.ActivityThread.main(ActivityThread.java:4745)
11-20 14:19:04.128: E/AndroidRuntime(10332): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 14:19:04.128: E/AndroidRuntime(10332): at java.lang.reflect.Method.invoke(Method.java:511)
11-20 14:19:04.128: E/AndroidRuntime(10332): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
11-20 14:19:04.128: E/AndroidRuntime(10332): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-20 14:19:04.128: E/AndroidRuntime(10332): at dalvik.system.NativeStart.main(Native Method)
11-20 14:22:38.050: E/AndroidRuntime(12344): FATAL EXCEPTION: main
11-20 14:22:38.050: E/AndroidRuntime(12344): java.lang.NullPointerException
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.text.Layout.getDesiredWidth(Layout.java:67)
11-20 14:22:38.050: E/AndroidRuntime(12344): at org.jraf.android.backport.switchwidget.Switch.makeLayout(Switch.java:378)
11-20 14:22:38.050: E/AndroidRuntime(12344): at org.jraf.android.backport.switchwidget.Switch.onMeasure(Switch.java:306)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.view.View.measure(View.java:15172)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:617)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:399)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.view.View.measure(View.java:15172)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.view.View.measure(View.java:15172)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1390)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.widget.LinearLayout.measureVertical(LinearLayout.java:681)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.widget.LinearLayout.onMeasure(LinearLayout.java:574)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.view.View.measure(View.java:15172)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
11-20 14:22:38.050: E/AndroidRuntime(12344): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2148)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.view.View.measure(View.java:15172)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1850)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1102)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1275)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4214)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.view.Choreographer.doCallbacks(Choreographer.java:555)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.view.Choreographer.doFrame(Choreographer.java:525)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.os.Handler.handleCallback(Handler.java:615)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.os.Handler.dispatchMessage(Handler.java:92)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.os.Looper.loop(Looper.java:137)
11-20 14:22:38.050: E/AndroidRuntime(12344): at android.app.ActivityThread.main(ActivityThread.java:4745)
11-20 14:22:38.050: E/AndroidRuntime(12344): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 14:22:38.050: E/AndroidRuntime(12344): at java.lang.reflect.Method.invoke(Method.java:511)
11-20 14:22:38.050: E/AndroidRuntime(12344): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
11-20 14:22:38.050: E/AndroidRuntime(12344): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-20 14:22:38.050: E/AndroidRuntime(12344): at dalvik.system.NativeStart.main(Native Method)
11-20 14:24:08.136: E/AndroidRuntime(12973): FATAL EXCEPTION: main
11-20 14:24:08.136: E/AndroidRuntime(12973): java.lang.NullPointerException
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.text.Layout.getDesiredWidth(Layout.java:67)
11-20 14:24:08.136: E/AndroidRuntime(12973): at org.jraf.android.backport.switchwidget.Switch.makeLayout(Switch.java:378)
11-20 14:24:08.136: E/AndroidRuntime(12973): at org.jraf.android.backport.switchwidget.Switch.onMeasure(Switch.java:306)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.view.View.measure(View.java:15172)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:617)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:399)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.view.View.measure(View.java:15172)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.view.View.measure(View.java:15172)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1390)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.widget.LinearLayout.measureVertical(LinearLayout.java:681)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.widget.LinearLayout.onMeasure(LinearLayout.java:574)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.view.View.measure(View.java:15172)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
11-20 14:24:08.136: E/AndroidRuntime(12973): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2148)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.view.View.measure(View.java:15172)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1850)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1102)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1275)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4214)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.view.Choreographer.doCallbacks(Choreographer.java:555)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.view.Choreographer.doFrame(Choreographer.java:525)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.os.Handler.handleCallback(Handler.java:615)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.os.Handler.dispatchMessage(Handler.java:92)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.os.Looper.loop(Looper.java:137)
11-20 14:24:08.136: E/AndroidRuntime(12973): at android.app.ActivityThread.main(ActivityThread.java:4745)
11-20 14:24:08.136: E/AndroidRuntime(12973): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 14:24:08.136: E/AndroidRuntime(12973): at java.lang.reflect.Method.invoke(Method.java:511)
11-20 14:24:08.136: E/AndroidRuntime(12973): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
11-20 14:24:08.136: E/AndroidRuntime(12973): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-20 14:24:08.136: E/AndroidRuntime(12973): at dalvik.system.NativeStart.main(Native Method)
I've getting this error when I try to add
<style name="Theme" parent="@android:Theme"> @style/Widget.Holo.CompoundButton.Switch </style>to my themes.xml, I have in my manifest:
This a really weird bug and it's probably not an issue with the library itself, but more of an issue with how the apk is compiled.
I've generated styles from http://android-holo-colors.com/ and I'm trying to use them to override the default Switch styles. The images that it generates are using the same names as the images provided by this library.
When I install my app on my Nexus One running 2.3.6, everything is fine and it's using my custom images. When I install the app on any of my 4.2 devices, it uses the default blue images.
Do you have any idea how to get this to work without having to rename all of my images? I've tried changing the ordering in the .classpath but to no avail.
Thanks!
Tried to use library.
Done everything as written in readme, everything works except no switch widget visible, the state of preference changed by just clicking no switch widget is seen. Tried on ICS JB devices and GB emulator
Without regenerating the assets, that is.
Help! I've spent way too much time trying to get the sample to work (which does great btw!) and then trying to get my app to work with this library.
I am apparently missing something simple. When the preferences screen loads I can click on the preference with the switch and it changes, but there is NO UI displayed in my app. It shows up JUST FINE in the demo.
It might be useful to know that I am using ActionBarSherlock, could be a conflict I guess with that library in the resources somehow?
I have had NO luck at all with any of the information that has been provided through logcat. It is hard to even know what to be looking for. There is certainly no glaring exceptions that are being thrown.
Any pointers would be greatly appreciated before I give up and go back to boring checkboxes. :-(
Failed to find style 'asb_switchStyle' in current theme
java.lang.NullPointerException
Exception details are logged in Window > Show View > Error Log
java.lang.NullPointerException
at android.text.Layout.getDesiredWidth(Layout.java:68)
at org.jraf.android.backport.switchwidget.Switch.makeLayout(Switch.java:350)
at org.jraf.android.backport.switchwidget.Switch.onMeasure(Switch.java:302)
at android.view.View.measure(View.java:17430)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:727)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:463)
at android.view.View.measure(View.java:17430)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:727)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:463)
at android.view.View.measure(View.java:17430)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
at android.view.View.measure(View.java:17430)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:875)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
at android.view.View.measure(View.java:17430)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:875)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
at android.view.View.measure(View.java:17430)
I added the style as described as follows :
<style name="AppTheme" parent="@android:style/Theme"> true false false @null @style/Widget.Holo.CompoundButton.Switch </style>stil i ma getting the error . I am assuming i am not describing the style properly can you please help.
I am a first time user of the switch backport. Thnx for making this code available.
I have trouble getting the text to appear correctly. In my sample project the text has not color (is just grey). This means that the "OFF" state text is not readable since the text is the same color as as the grey background. This is different from the sample app that comes with the switch backport where text is displayed in a light grey.
I am unable to set the text color myself with xml attributes.
When I comment out lines 178-184 from Switch.java, text is displayed correctly:
colors = appearance.getColorStateList(R.styleable.Android_android_textColor);
if (colors != null) {
mTextColors = colors;
} else {
// If no color set in TextAppearance, default to the view's textColor
mTextColors = getTextColors();
}
into
//colors = appearance.getColorStateList(R.styleable.Android_android_textColor);
// if (colors != null) {
// mTextColors = colors;
// } else {
// If no color set in TextAppearance, default to the view's textColor
mTextColors = getTextColors();
//}
Is there an obvious thing that I am doing wrong here?
Hello.What the title says. I have no luck yet
Hi,
I've managed to switch the background color from blue to green but now I want to change the text color?
<org.jraf.android.backport.switchwidget.Switch
android:id="@+id/th"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:thumb="@drawable/apptheme_switch_inner_holo_light"
app:track="@drawable/apptheme_switch_track_holo_light"
app:textOn="@string/switch_yes"
app:textOff="@string/switch_no"
android:textColor="#000000"
/>
But it isn't working.
Hi,
I generated my custom style of Switch in this site : http://android-holo-colors.com/
I added the drawable folders to my project and I inflated the Custom Switch like this :
<org.jraf.android.backport.switchwidget.Switch xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res/com.myproject"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:thumb="@drawable/switch_inner_holo_light"
app:track="@drawable/switch_track_holo_light" />
My custom style is applied correctly on Android 2.3 BUT NOT on Android 4.2 like Samsung Galaxy S4.
I also tried to create "drawable-xxx-v16" folders with the drawables but doesn't work too.
Where is my problem ?
Soory for my English, I am French.
Thanks you for your help.
When binding SwitchPreference to a OnPreferenceClickListener, if the user clicks on the Switch instead of the rest of the widget (ie Label), the listener is not being called.
Modifying the CompoundButton.OnCheckedChangeListener associated to the inner Switch fixes the issue:
private class Listener implements CompoundButton.OnCheckedChangeListener {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (!callChangeListener(isChecked)) {
// Listener didn't like it, change it back.
// CompoundButton will make sure we don't recurse.
buttonView.setChecked(!isChecked);
return;
}
SwitchPreference.this.setChecked(isChecked);
if (getOnPreferenceClickListener() != null) {
getOnPreferenceClickListener().onPreferenceClick(SwitchPreference.this);
}
}
}
I believe that if the Listener returns false, should rollback the checked state as on the above block.
Hello,
Can you please consider publishing your library on Maven Central or JCenter for every release ?
JRAF is currently down (http://www.downforeveryoneorjustme.com/jraf.org).
Maven Central or JCenter are more reliable repositories than JRAF.
Thank you.
if add android:theme="@android:style/Theme.NoTitleBar" to AndroidManifest.xml,the example will crash
Sorry, I have no time to investigate further. Here is a stacktrace. Someone else mentioned this on stackoverflow, too... Does not appear in the emulator.
04-28 01:10:15.335: E/AndroidRuntime(30182): FATAL EXCEPTION: main
04-28 01:10:15.335: E/AndroidRuntime(30182): Process: de.t_animal.journeyapp, PID: 30182
04-28 01:10:15.335: E/AndroidRuntime(30182): java.lang.NullPointerException
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.text.Layout.getDesiredWidth(Layout.java:67)
04-28 01:10:15.335: E/AndroidRuntime(30182): at org.jraf.android.backport.switchwidget.Switch.makeLayout(Switch.java:350)
04-28 01:10:15.335: E/AndroidRuntime(30182): at org.jraf.android.backport.switchwidget.Switch.onMeasure(Switch.java:302)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.view.View.measure(View.java:16497)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.view.View.measure(View.java:16497)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.view.View.measure(View.java:16497)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1451)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.view.View.measure(View.java:16497)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.view.View.measure(View.java:16497)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
04-28 01:10:15.335: E/AndroidRuntime(30182): at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:327)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.view.View.measure(View.java:16497)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
04-28 01:10:15.335: E/AndroidRuntime(30182): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2291)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.view.View.measure(View.java:16497)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1916)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1113)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1295)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.view.Choreographer.doCallbacks(Choreographer.java:574)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.view.Choreographer.doFrame(Choreographer.java:544)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.os.Handler.handleCallback(Handler.java:733)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.os.Handler.dispatchMessage(Handler.java:95)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.os.Looper.loop(Looper.java:136)
04-28 01:10:15.335: E/AndroidRuntime(30182): at android.app.ActivityThread.main(ActivityThread.java:5017)
04-28 01:10:15.335: E/AndroidRuntime(30182): at java.lang.reflect.Method.invokeNative(Native Method)
04-28 01:10:15.335: E/AndroidRuntime(30182): at java.lang.reflect.Method.invoke(Method.java:515)
04-28 01:10:15.335: E/AndroidRuntime(30182): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
04-28 01:10:15.335: E/AndroidRuntime(30182): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
04-28 01:10:15.335: E/AndroidRuntime(30182): at dalvik.system.NativeStart.main(Native Method)
I'm trying to use this library using Gradle. I imported it in the gradle file like so:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
allprojects {
repositories {
mavenCentral()
maven {
url "http://JRAF.org/static/maven/2"
}
}
}
dependencies {
compile project(':OurProject')
compile (''org.jraf:android-switch-backport:1.1')
instrumentTestCompile(files('libs/espresso-1.0-SNAPSHOT-bundled.jar'))
}
I then try to import the Switch class in my fragment using the following line:
import org.jraf.android.backport.switchwidget.Switch;
The strange thing is that it knows the whole part of this url up until the actual class. So it reconises org.jraf.android.backport.switchwidget.
, but it only doesn't know the Switch class.
When I try to use it in my xml file like so:
<org.jraf.android.backport.switchwidget.Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
I get an error saying it can't find R anymore (i.e.: R doesn't build anymore because the use of the Switch in my xml creates an error).
I'm using the Android Studio IDE. Any ideas how I could solve this?
Any help would be very very welcome!
Project resources override library resources, but only specifically with respect to qualifiers.
For instance, project/drawable/xxx.png overrides lib/drawable/xxx.png but not lib/drawable-v16/xxx.png
The easiest way to deal with this is to rename the resources with a library specific prefix, to avoid conflicts.
Device: LG Optimus
Android version 2.3.3
I'm inflating the xml in a customView of my actionbar. It works on 4.0 but not on 2.3.3
Java code:
View mActionBarView = getLayoutInflater().inflate(R.layout.custom_switch, null);
mActionBarView.findViewById(R.id.switch_server);
getSupportActionBar().setCustomView(mActionBarView);
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM |
ActionBar.DISPLAY_SHOW_HOME|ActionBar.DISPLAY_USE_LOGO|ActionBar.DISPLAY_SHOW_TITLE);
xml:
<org.jraf.android.backport.switchwidget.Switch
android:id="@+id/switch_server"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
Could you please deploy this library as AAR for Gradle/Android Studio users?
Thank you! :)
When an OnPreferenceChangeListener returns false the switch should not be triggered.
What currently happens is the switch is moved to the ON position, but remains dull.
The switch correctly doesnt lightup but it shouldnt even move position. This gives the illusion that the switch is On, when in fact it is not.
This was verified against the built-in switch, with the backport using the default style.
I used the Gradle instructions. After adding the repo and dependency the Gradle build process gets stuck on "compiling dependencies". After I took out the repo and dependency Gradle built correctly. I am using Android Studio 0.4.3, and Gradle 1.9.
Hi, I want to change the background of switch in preference but after set app:track with my custom background, it does not work.
Have you seen similar issue before? And How do I fix this? I have no problem when I set in regular switch
Please just publish the last release (1.3) on maven central. The last version published is 1.0 and when your repo is down we can't download the artefact.
Hi
It seems JRAF.org is down and I can't use http://JRAF.org/static/maven/2 in gradle
Hello,
I like the switch look and feel but they are quite small compared to regular buttons.
Is there a way to make the switch bigger? Either by setting a property, or by generating new assets)
I tried to increase the height of the widget, but it doesn't change the size of the switch, only the embedding panel's.
Is this in any way related to #23 ?
Would be great if this were available via maven so we could add the dependency to our pom.xml and then just start developing.
java.lang.NullPointerException
at android.text.Layout.getDesiredWidth(Layout.java:67)
at org.jraf.android.backport.switchwidget.Switch.makeLayout(Switch.java:350)
at org.jraf.android.backport.switchwidget.Switch.onMeasure(Switch.java:302)
at android.view.View.measure(View.java:16497)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455)
at android.view.View.measure(View.java:16497)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455)
at android.view.View.measure(View.java:16497)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.view.View.measure(View.java:16497)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
at android.view.View.measure(View.java:16497)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2291)
at android.view.View.measure(View.java:16497)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1912)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1109)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1291)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:544)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
There is conflict in my project when I try to use this library with compile betterpickers library. Gradle report following error:
Error:Attribute "switchStyle" has already been defined
Error:Attribute "switchPreferenceStyle" has already been defined
Hello,
I'm trying to use this widget with HoloEverywhere (https://github.com/Prototik/HoloEverywhere), and when I try to run my app the console shows these errors:
android-switch-backport-master\library\res\values\attrs.xml:61: error: Attribute "thumb" has already been defined
android-switch-backport-master\library\res\values\attrs.xml:63: error: Attribute "track" has already been defined
android-switch-backport-master\library\res\values\attrs.xml:65: error: Attribute "textOn" has already been defined
android-switch-backport-master\library\res\values\attrs.xml:67: error: Attribute "textOff" has already been defined
android-switch-backport-master\library\res\values\attrs.xml:69: error: Attribute "thumbTextPadding" has already been defined
android-switch-backport-master\library\res\values\attrs.xml:71: error: Attribute "switchTextAppearance" has already been defined
android-switch-backport-master\library\res\values\attrs.xml:73: error: Attribute "switchMinWidth" has already been defined
android-switch-backport-master\library\res\values\attrs.xml:75: error: Attribute "switchPadding" has already been defined
android-switch-backport-master\library\res\values\attrs.xml:78: error: Attribute "switchStyle" has already been defined
How can this be solved?
Thanks!
There is a problem with your maven repo. The server is down currently.
Hi,
I've just cloned master to see if it could work as I need, and I got several warnings, so if you could please resolve why it is done this way.
@SuppressWarnings
in Switch.java:99
99: @SuppressWarnings("hiding")
100: private final Rect mTempRect = new Rect();
mSendClickAccessibilityEvent
in TwoStatePreference.java:49
49: private boolean mSendClickAccessibilityEvent;
...
73: mSendClickAccessibilityEvent = true;
as far as this member is private, and only one assignment is done in onClick() and no further use, it is probably just leftover
When using SwitchPreference in a preference xml file it crashes with a ClassNotFoundException when trying to resolve SwitchPreference.
Inspecting the AAR file and the classes.jar inside it shows that Dalvik is correct - there is no SwitchPreference.class present. Apparently ProGuard renames the SwitchPreference class to a.class in the AAR file.
Stack trace (replaced original package name with a.b.c):
12-10 11:18:58.578 27807-27913/a.b.c.android E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{a.b.c.android/a.b.c.android.settings.SettingActivity}: android.view.InflateException: Binary XML file line #20: Error inflating class org.jraf.android.backport.switchwidget.SwitchPreference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2071)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
at android.app.ActivityThread.access$600(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:4787)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #20: Error inflating class org.jraf.android.backport.switchwidget.SwitchPreference
at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:441)
at android.preference.GenericInflater.rInflate(GenericInflater.java:481)
at android.preference.GenericInflater.rInflate(GenericInflater.java:493)
at android.preference.GenericInflater.inflate(GenericInflater.java:326)
at android.preference.GenericInflater.inflate(GenericInflater.java:263)
at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:269)
at android.preference.PreferenceActivity.addPreferencesFromResource(PreferenceActivity.java:1418)
at a.b.c.android.settings.SettingActivity.onCreate(SettingActivity.java:78)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2035)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
at android.app.ActivityThread.access$600(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:4787)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: org.jraf.android.backport.switchwidget.SwitchPreference
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.preference.GenericInflater.createItem(GenericInflater.java:375)
at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:430)
at android.preference.GenericInflater.rInflate(GenericInflater.java:481)
at android.preference.GenericInflater.rInflate(GenericInflater.java:493)
at android.preference.GenericInflater.inflate(GenericInflater.java:326)
at android.preference.GenericInflater.inflate(GenericInflater.java:263)
at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:269)
at android.preference.PreferenceActivity.addPreferencesFromResource(PreferenceActivity.java:1418)
at a.b.c.android.settings.SettingActivity.onCreate(SettingActivity.java:78)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2035)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
at android.app.ActivityThread.access$600(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:4787)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
When we try to customize this switch using the property :
android:thumb="@drawable/switch_thumb"
android:track="@drawable/switch_bg"
(as described here http://stackoverflow.com/questions/10118050/how-can-i-style-an-android-switch)
it doesn't work whereas with the Switch from android sdk it works !
Hello,
After adding library to android studio as submodle and using switch in layout, I got "Rendering Problem" in preview window. Here is the stacktrace:
Rendering Problems java.lang.NullPointerException
at android.text.Layout.getDesiredWidth(Layout.java:67)
at org.jraf.android.backport.switchwidget.Switch.makeLayout(Switch.java:350)
at org.jraf.android.backport.switchwidget.Switch.onMeasure(Switch.java:302)
at android.view.View.measure(View.java:16458)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
at android.view.View.measure(View.java:16458)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.view.View.measure(View.java:16458)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
at android.view.View.measure(View.java:16458)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
at android.view.View.measure(View.java:16458)
I my layout I simply put Switch, just like in sample.
There was also a problem with using appcompat library, because there was name clash with styles, and I changed following lines in attrs.xml:
<declare-styleable name="Theme">
<attr name="switchStyle" format="reference" />
<attr name="switchPreferenceStyle" format="reference" />
</declare-styleable>
to
<declare-styleable name="SwitchTheme">
<attr name="switchStyle" format="reference" />
<attr name="switchPreferenceStyle" format="reference" />
</declare-styleable>
This only happens in editor, since switch i working fine, but is rather annoying, because it prevents your layout from being displayed
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.