Search code examples
androidandroid-4.0-ice-cream-sandwichnavigation-drawerandroid-3.0-honeycombandroid-2.3-gingerbread

Problems while displaying navigation drawer on Gingerbread version of android


I have created a navigation drawer in my project of android 4.1 version. Now I have added backward support to froyo as well in my app using the support libraries. But in the drawer_list_item xml file, it is showing some error in these lines, when I try to run it on gingerbread.

1) android:minHeight="?android:attr/listPreferredItemHeightSmall"
2) android:textAppearance="?android:attr/textAppearanceListItemSmall"

I have found from another website that the line 1 is only available on API 11+ and line 2 is only available on API 14+. So my question is, Is there any other alternative to these two lines of code, which makes my code run on lower version devices such as gingerbread as well. Now when I try to remove these two lines of code from my xml file, the app runs file, but the navigation drawer list items are not properly displayed correctly. So I need an alternative for the lines 1 & 2 for my project. Any help from any one is easily appreciated. Thanks in advance..


Solution

  • because those are values you can replace them by your own custom attributes, to find more about them look at

    https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/themes.xml#L123

    which you can find corresponding values. you can create your own attribute files to run on any device without

    any version restriction by using the values from above link and creating XML attribute file. in order to find

    how to create attribute file look at google doc.