Switchcompat not displaying the Switch

I had same problem today but somehow it switchcompat worked in my sample. I think that there is problem with app style, it parent should be set to:

Theme.AppCompat

Alternatively, you can utilize

android:theme="@style/Theme.AppCompat"

On your control


I'm not sure if this is a bug in the support library, but you have to ensure that the context for your layout inflater is a themed one.

  1. Make sure your activities theme Theme.AppCompat as parent
  2. If you use inflate SwitchCompat in ListView or RecyclerView you have to ensure that the LayoutInflater you instantiate and use in your adapter is created with the themed context. You can retrieve the themed context by calling: Activity.getSupportActionBar().getThemedContext()