Tag: android-support-library

Styling the SearchView Widget using support library v21

I’m trying to style the SearchView widget using the new AppCompat v21, but I’m facing some problems. No matter what layout I set on “suggestionRowLayout” attribute, it does nothing at all. The suggestion dropdown list of the SearchView remains the same way. Other problem that I’m having is when the “accent color” is the same […]

Android support Toolbar not displaying custom drawable properly

I’m trying to update my apps ActionBar into toolbar but I encountered some problem on customizing my Toolbar to display a custom drawable. What I tried so far is to set my xml drawable into the Toolbar but it destroys the whole toolbar and moved the menu button down where I cannot properly see it: […]

Error inflating class android.support.v7.widget.Toolbar. My mistake or bug?

I had the following rendering issue on all my layouts when using SDK 22 to preview them. Error inflating class android.support.v7.widget.Toolbar. java.lang.NoSuchFieldError: View_theme In my case , the problem was styles.xml: XML with rendering problem: <resources> <style name=”AppBaseTheme” parent=”Theme.AppCompat.Light.DarkActionBar” /> <!– Base application theme. –> <style name=”AppTheme” parent=”AppBaseTheme”> <item name=”colorPrimary”>@color/primary</item> <item name=”colorPrimaryDark”>@color/primary_dark</item> <item name=”colorAccent”>@color/accent</item> <item […]

Try to Understand the behavior of BottomSheet in android support library 23.2.1

I am trying to implement Bottom sheet in one of my activities and I am kind of confused by the way it is behaving! So here is the problem, I have an activity in which I am trying to show Bottom sheet and I see that: if we dont set the app:behavior_peekHeight property then the […]

Android support v7 can't find ActionBarActivity

I’ve used all the manuals available and finally i was managed to add the v7 support to my android version 2.3 project. I’m trying to add ActionBarActivity but it can’t be found.. although ActionBar is found… This is me trying to get ActionBarActivity. This is my SDK Manager As you can see i can import […]

ClassCastException: CustomFragment cannot be cast to android.app.Fragment / Using android.support.v4.app.Fragment

I am developing an application divided in one library and two applications : 1 for phones, the other for tablets. A lot of code and layout is defined in the library, and only a few parts are defined in the applications. I’m using fragments in an Activity, with a ViewPager for the phone version (layout […]

MenuItemCompat.setOnActionExpandListener doesn't do anything

Background I have a searchView being initialized using a special class I’ve made, that’s being used across all of the activities and fragments. The problem Recently, probably due to updates to the support library (or because I didn’t use it so far, I don’t remember), I can’t catch events of expand/collapse of the searchView. As […]

Android use support library to support SearchView

This is my code: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { MenuItem searchItem = menu.findItem(R.id.searchMenuItem); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem); // searchView.set searchView.setSearchableInfo( searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(false); } My minimum API is 8. I have this compile error Call requires API level 11 (current min is 8): android.widget.SearchView#setSearchableInfo Note, that I can’t change the […]

TabLayout missing after updating Design Support Library

I updated the design support library from version 22.2.0 to 22.2.1 yesterday and I’m facing a strange behaviour with TabLayout. On version 22.2.0, the TabLayout worked just fine, but now it doesn’t show up in my frag unless I rotate my phone (then it appears). I haven’t changed my code, it just stopped working. Here […]

23.2.0 set vector drawable as background in 4.X

I am super excited about the new possibility to set vector drawables to layouts using the app:srcCompat=”@drawable/icon” attribute introduced in support-library 23.2.0. But I wonder how I can fetch one of this drawables programmatically or set is as background. I thought about something like: ContextCompat.getDrawable(context, R.drawable.icon) Is this even possible?

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.