10

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!

Janine Kroser
  • 444
  • 2
  • 6
  • 23
  • You're asking why the `ToggleButton` isn't working in Preview? If so please update the question. – miensol Jan 12 '16 at 06:58
  • No, I don't. I'm asking for a solution why the error "E/dalvikvm: Could not find class 'android.widget.ThemedSpinnerAdapter', referenced from method android.support.v7.widget.AppCompatSpinner$DropDownAdapter." occurs. – Janine Kroser Jan 12 '16 at 07:36
  • Possible duplicate of [http://stackoverflow.com/questions/33416691/could-not-find-class-android-widget-themedspinneradapter](http://stackoverflow.com/questions/33416691/could-not-find-class-android-widget-themedspinneradapter) – miensol Jan 12 '16 at 07:40
  • Don't think so. The author of this question was satisfied with the answer. Unfortunately the suggested solution only removes the rendering problem error in Android Studio but not the error itself, that occurs when running on a device. – Janine Kroser Jan 12 '16 at 07:43
  • If I read the other questions and comments correctly the problem is about running on device (they even mention SG II). – miensol Jan 12 '16 at 07:51
  • So it is a bug in Android SDK? – Janine Kroser Jan 12 '16 at 07:54
  • I'm not sure really :) – miensol Jan 12 '16 at 07:54

4 Answers4

8

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.

Lalit Fauzdar
  • 5,953
  • 2
  • 26
  • 50
  • I'm using radius property only and still receiving the warning. Any combination of using selective round corners gives the warning. Only if you use radius w/o selective round corners gets rid of the warning. – AlexVPerl Oct 31 '17 at 04:28
  • 2
    @AlexVPerl Quick workaround is that you should use the drawable resource as src instead of background which means 'android:src="@drawable/your_drawable_name"`. – Lalit Fauzdar Oct 31 '17 at 05:34
6

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

user2858738
  • 520
  • 4
  • 15
2

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'

Exutic
  • 91
  • 4
0

This issue comes when you use 'com.google.android.material:material:1.2.0-alpha03'version. You simply need to downgrade the version to 'com.google.android.material:material:1.2.0-alpha02'in your build.gradle(module app). It will fix the issue.

Asad Khan
  • 61
  • 1
  • 3