Posts

Showing posts with the label Android Appcompat

Android VectorDrawables.useSupportLibrary = True Is Stopping App

Answer : You cannot use Vector Drawables in any other views except ImageView in pre-lollipop. Please see this SO Answer by google developer advocate. For AppCompat users, we’ve decided to remove the functionality which let you use vector drawables from resources on pre-Lollipop devices due to issues found in the implementation in version 23.2.0/23.2.1 [ https://code.google.com/p/android/issues/detail?id=205236, https://code.google.com/p/android/issues/detail?id=204708 ]. Using app:srcCompat and setImageResource() continues to work. If you want to use the Vector Drawables pre-lollipop, use can set it programatically by converting it into a drawable. Drawable drawable; if (android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { drawable = context.getResources().getDrawable(drawableResId, context.getTheme()); } else { drawable = VectorDrawableCompat.create(context.getResources(), drawableResId, context.getTheme()); } button.setCompoundDrawablesWithIn...

Android Transparent Status Bar And Actionbar

Image
Answer : I'm developing an app that needs to look similar in all devices with >= API14 when it comes to actionbar and statusbar customization. I've finally found a solution and since it took a bit of my time I'll share it to save some of yours. We start by using an appcompat-21 dependency. Transparent Actionbar : values/styles.xml : <style name="AppTheme" parent="Theme.AppCompat.Light"> ... </style> <style name="AppTheme.ActionBar.Transparent" parent="AppTheme"> <item name="android:windowContentOverlay">@null</item> <item name="windowActionBarOverlay">true</item> <item name="colorPrimary">@android:color/transparent</item> </style> <style name="AppTheme.ActionBar" parent="AppTheme"> <item name="windowActionBarOverlay">false</item> <item name="colorPrimary...