Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Path.isConvex is not supported. Android Studio - Toggle Button

I already read about this issue on stackoverflow but unfortunately haven't found the correct answer.

I use a ToggleButton and it shows me the following error in the rendering window:

The graphics preview in the layout editor may not be accurate: 
- Different corner sizes are not supported in Path.addRoundRect. (Ignore for this session) 
- Path.isConvex is not supported. (Ignore for this session)

The terminal shows the following error message:

E/dalvikvm: Could not find class 'android.widget.ThemedSpinnerAdapter', referenced from method android.support.v7.widget.AppCompatSpinner$DropDownAdapter.<init>

When I set the api level in the rendering window to 19 instead of 23 the "Rendering problem" window won't appear but the error still occurs in the app when running on a device with Android 4.4.2.

This is my simple ToggleButton:

<ToggleButton
                android:id="@+id/editToggleKunde6"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textOn="@string/kunde_bearbeiten_txt1"
                android:textOff="@string/kunde_bearbeiten_txt2"
                android:checked="true"
                />

Thanks for any idea!

like image 822
Janine Kroser Avatar asked Jan 12 '16 06:01

Janine Kroser


3 Answers

Path.isConvex can be removed by using only a single tag for radius than for each corner... so instead of using

<corners 
    android:bottomLeftRadius="10dp"
    android:bottomRightRadius="10dp"
    android:topLeftRadius="10dp"
    android:topRightRadius="10dp"/>

put this

<corners android:radius="10dp"/>

Also, Selective round corners can be achieved using the following code

<corners android:radius="10dp" android:bottomLeftRadius="0dp" android:topRightRadius="0dp"/>

Edit (easy way)

In order to fix it, you can also set it as src instead of background as android:src="@drawable/your_drawable_name"

No problem, It works fine. Tested by me just now.

like image 98
Lalit Fauzdar Avatar answered Oct 29 '22 10:10

Lalit Fauzdar


You are getting this error because some rounded and other square corners do not render at all. You need to provide radius for the toggle button.

Source: https://code.google.com/p/android/issues/detail?id=72999

like image 24
user2858738 Avatar answered Oct 29 '22 10:10

user2858738


this implementation has a render problem . or its not fixed . the version before works fine

implementation 'com.google.android.material:material:1.2.0-alpha03'

-->

implementation 'com.google.android.material:material:1.2.0-alpha02'

like image 37
Exutic Avatar answered Oct 29 '22 09:10

Exutic