To support versions before Lollipop, use
com.android.support:appcompat-v7:24.0.0 (or later)
support library.
And then, instead of
ContextCompat.getDrawable(view.getContext(), id);
use this one
AppCompatResources.getDrawable(view.getContext(), id);
More Related Contents:
- AppCompat 23.3 Support Vectors no longer work?
- Null pointer exception with “setDisplayHomeAsUpEnabled(boolean)” [duplicate]
- Android transparent status bar and actionbar
- How to implement DrawerArrowToggle from Android appcompat v7 21 library
- Actionbar not shown with AppCompat
- Why does Eclipse automatically add appcompat v7 library support whenever I create a new project?
- Use Tab with new ToolBar (AppCompat v7-21)
- Change Toolbar color in Appcompat 21
- Flinging with RecyclerView + AppBarLayout
- Creating a SearchView that looks like the material design guidelines
- failed to resolve com.android.support:appcompat-v7:22 and com.android.support:recyclerview-v7:21.1.2
- show icon in actionbar/toolbar with AppCompat-v7 21
- Material Design not styling alert dialogs
- Error in styles_base.xml file – android app – No resource found that matches the given name ‘android:Widget.Material.ActionButton’
- InflateException with FloatingActionButton from Official Design Library
- How to fix: “You need to use a Theme.AppCompat theme (or descendant) with this activity”
- How to properly use backwards compatible Vector Drawable with the latest Android Support Library?
- How to implement the Material-design Elevation for Pre-lollipop
- Unable to write jarlist cache file while creating android project
- Change fill color on vector asset in Android Studio
- Don’t collapse Toolbar when RecyclerView fits the screen
- Android 5.0: how to change recent apps title color?
- play-services-ads conflicts with appcompat
- How can I modify ripple color when using ?attr/selectableItemBackground as background?
- How do I style appcompat-v7 Toolbar like Theme.AppCompat.Light.DarkActionBar?
- How animate Burger to Arrow with Appcompat v7 21, Toolbar and DrawerLayout
- Android Material Design Datepicker with AppCompat
- NoClassDefFoundError: Failed resolution of: Landroid/support/v7/appcompat/R$styleable
- Getting exception : java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV14
- gradle, Could not expand ZIP appcompat-v7:19.0.1