GwonHyeok/StickySwitch

Error inflating class io.ghyeok.stickyswitch.widget.StickySwitch

rrenanh opened this issue · 1 comments

I'm trying to use a alertdialog from a layout containing the switch.

I get the error:
android.view.InflateException: Binary XML file line #39 in com.example.authenticatorapp:layout/layout_movimentacao_dialog: Binary XML file line #39 in com.example.authenticatorapp:layout/layout_movimentacao_dialog: Error inflating class io.ghyeok.stickyswitch.widget.StickySwitch

Can anybody help please?

xml code:
<io.ghyeok.stickyswitch.widget.StickySwitch android:id="@+id/sticky_switch" android:layout_width="wrap_content" android:layout_height="wrap_content" app:ss_animationDuration="600" app:ss_animationType="line" app:ss_iconPadding="18dp" app:ss_iconSize="22dp" app:ss_selectedTextSize="14sp" app:ss_textSize="12sp" />

Activity code:
`private void openMovimentacaoDialog() {
LayoutInflater inflater = LayoutInflater.from(this);
View view = inflater.inflate(R.layout.layout_movimentacao_dialog, null);

    AlertDialog alertDialog = new AlertDialog.Builder(this)
            .setView(view)
            .create();

    alertDialog.show();
}`

Hi there !

You most likely need the Kotlin standard library. Had the same problem and fixed it with :

implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.10"

Should work for you as well !