GestureOverlayView DrawerLayout

  • Replies:6
jko
  • Forum posts: 5

Mar 7, 2014, 4:58:28 AM via Website

I'm having problems trying to get a main layout with slide out menu or navigation drawer. I already using a Gesture overlay view and it seems that drawer layout is causing a inflation error. How can I implement a slide drawer with gesture overlay? Links are left out because forum will not allow.

1<android.support.v4.widget.DrawerLayout
2 xmlns:android=""
3 xmlns:tools=""
4 android:id="@+id/drawer_layout"
5 android:layout_width="match_parent"
6 android:layout_height="match_parent">
7
8
9 <android.gesture.GestureOverlayView
10 xmlns:android="
11 xmlns:tools=""
12 android:id="@+id/gestureOverlayView1"
13 android:layout_width="match_parent"
14
15 android:layout_height="match_parent"
16 tools:context=".MainActivity">
17
18
19
20 <LinearLayout
21 android:id="@+id/LinearLayout1"
22 android:layout_width="fill_parent"
23 android:layout_height="fill_parent"
24 android:orientation="vertical"
25 android:padding="10dp"
26 android:layout_gravity="start">
27
28
29
30 <TextView
31 android:id="@+id/timerTextView"
32 android:layout_width="wrap_content"
33 android:layout_height="wrap_content"
34 android:layout_gravity="right"
35 android:layout_marginRight="5sp"
36 android:text="@string/startTime"
37 android:textAppearance="?android:attr/textAppearanceSmall"
38 android:textSize="30sp" />
39
40 <TextView
41 android:id="@+id/hanziTextView"
42 android:layout_width="fill_parent"
43 android:layout_height="0dp"
44 android:layout_weight="1"
45 android:ems="10"
46 android:gravity="center"
47 android:textSize="50sp" />
48
49 <TextView
50 android:id="@+id/instructionTextView"
51 android:layout_width="574dp"
52 android:layout_height="wrap_content"
53 android:layout_weight="0.05"
54 android:textSize="40sp" />
55
56</LinearLayout>
57
58</android.gesture.GestureOverlayView>
59
60 <FrameLayout
61 android:id="@+id/content_frame"
62 android:layout_width="match_parent"
63 android:layout_height="match_parent" />
64 <!-- The navigation drawer -->
65 <ListView android:id="@+id/left_drawer"
66 android:layout_width="240dp"
67 android:layout_height="match_parent"
68 android:layout_gravity="start"
69 android:choiceMode="singleChoice"
70 android:divider="@android:color/transparent"
71 android:dividerHeight="0dp"
72 android:background="#111"/>
73
74
75
76
77
78</android.support.v4.widget.DrawerLayout>

— modified on Mar 7, 2014, 6:56:44 PM

Reply
Pascal P.
  • Admin
  • Forum posts: 11,286

Mar 7, 2014, 11:35:05 AM via Website

android.gesture.GestureOverlayView must have the layout gravity start then the whole layout is a left or roght Navigation drawer.

LG Pascal //It's not a bug, it's a feature. :) ;)

Reply
jko
  • Forum posts: 5

Mar 7, 2014, 2:12:12 PM via Website

I'm not sure I understand. Instead of linear layout I should use gravity layout? Everything that is in linear layout is for the main screen and not for the drawer. The drawer at this point should be blank.

Reply
Pascal P.
  • Admin
  • Forum posts: 11,286

Mar 7, 2014, 2:31:18 PM via Website

ok, the gesture view must have the Attribute android:layout_gravity = "start".
Looks like this:
1<android.gesture.GestureOverlayView
2
3 android:id="@+id/gestureOverlayView1"
4 android:layout_width="match_parent"
5android:layout_gravity="start"
6 android:layout_height="match_parent" tools:context=".MainActivity">

LG Pascal //It's not a bug, it's a feature. :) ;)

Reply
jko
  • Forum posts: 5

Mar 7, 2014, 4:52:24 PM via Website

I updated the code with your suggestion but still getting same error. Gesture layout does work without Drawer layout, the addition of drawer layout is causing the error.

Reply
Pascal P.
  • Admin
  • Forum posts: 11,286

Mar 7, 2014, 5:01:58 PM via Website

Then i think it's not possible to do this

LG Pascal //It's not a bug, it's a feature. :) ;)

Reply
jko
  • Forum posts: 5

Mar 7, 2014, 6:59:01 PM via Website

So it turns out it does work. The problem I was having was with my lib. The android-support-v4.jar, there was something wrong. Possible cause, not exactly sure what it could of been was cloning the project from my own github. I ended copying and paste the code into another project and it worked just fine. I wish I can fix my original project though.

— modified on Mar 7, 2014, 6:59:44 PM

Reply