1

i'm define this below layout XML for activity. in this layout i'm define slide menu and i'm using Fragment and FrameLayout with supported in older of android sdk. but i get error in Android 2.2 this error is not API Level > 8, how to resolve this layout problem and fix that for Android 2.2?

<?xml version="1.0" encoding="utf-8"?>

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
                                        xmlns:tools="http://schemas.android.com/tools"
                                        android:id="@+id/drawer_layout"
                                        android:layout_width="match_parent"
                                        android:layout_height="match_parent"
                                        tools:context="com.example.slidemenu.MainActivity"
                                        android:background="#ffffff">
<ListView
        android:id="@+id/lstContent"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:dividerHeight="0dip"
        android:divider="@null"
        android:fastScrollEnabled="true"
        android:longClickable="true"
        android:fadeScrollbars="true">
</ListView>
<FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

<fragment
        android:id="@+id/navigation_drawer"
        android:name="ir.tsms.Fragments.NavigationDrawerFragment"
        android:layout_width="@dimen/navigation_drawer_width"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        tools:layout="@layout/fragment_navigation_drawer" />

</android.support.v4.widget.DrawerLayout>

in Activity my class extends from ActionBarActivity, i'm say again i dont have any problem in android 4, thanks.

public class ActivityMain extends ActionBarActivity implements AbsListView.OnScrollListener, NavigationDrawerFragment.NavigationDrawerCallbacks {

Error:

FATAL EXCEPTION: main android.view.InflateException: Binary XML file line #17: Error inflating class

3 Answers3

0

I think you need to use v7 instead of v4. because you use ActionBarActivity class :

Difference between android-support-v7-appcompat and android-support-v4

Community
  • 1
  • 1
Blaze Tama
  • 10,828
  • 13
  • 69
  • 129
0

public class ActivityMain extends ActionBarActivity

To

public class ActivityMain extends FragmentActivity

Jay Rathod
  • 11,131
  • 6
  • 34
  • 58
0

maybe print for us this error...

also

android:layout_gravity="start"

should be set for FrameLayout (parent), not fragment (child). Drawer check its childs not, child's childs. v4 is enough

snachmsm
  • 17,866
  • 3
  • 32
  • 74