Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You may use it in the following manner: </p> <pre><code>&lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/main_layout" tools:context=".ExampleMain" &gt; &lt;!-- Main Content place holder --&gt; &lt;FrameLayout android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;andriod.support.v4.view.ViewPager android:id="@+id/main_content_pager" android:layout_width="match_parent" android:layout_height="match_parent"/&gt; &lt;/FrameLayout&gt; &lt;!-- Left Drawer main style --&gt; &lt;ListView style="@style/HighlightColor" android:id="@+id/left_drawer" android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="start" android:choiceMode="singleChoice" android:divider="@android:color/transparent" android:dividerHeight="0dp" /&gt; &lt;/android.support.v4.widget.DrawerLayout&gt; </code></pre> <p>NavigationDrawer as per design is designed in such a way that it will show up if you try to swipe from 20dp margin of left (or right) part of the screen.</p> <p><strong>EDIT 1:</strong> In case you want to put the views in separate xmls you can very well do that and add the views at run time.</p> <p>Write another xmls as follows: <strong>view_pager.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; </code></pre> <p><strong>main_layout.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/main_layout" &gt; &lt;!-- Main Content place holder --&gt; &lt;FrameLayout android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent"/&gt; &lt;!-- Left Drawer main style --&gt; &lt;ListView android:id="@+id/left_drawer" android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="start" android:choiceMode="singleChoice" android:divider="@android:color/transparent" android:dividerHeight="0dp" /&gt; &lt;/android.support.v4.widget.DrawerLayout&gt; </code></pre> <p>Then in the onCreate of your activity you can the following code:</p> <pre><code>@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_layout); ViewPage pager = (ViewPager) LayoutInflater.from(this).inflate(R.layout.view_pager, null, false); ViewGroup container = (ViewGroup) findViewById(R.id.main_content); container.addView(pager); } </code></pre> <p>I hope it Helps!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload