Android custom layout as navigation drawer -


i trying build standard simple navigation drawer have many elements using arrayadapter when click on element need load html webview inside drawer, possible somehow? expected drawer structure

i building such layout that:

 <?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/activity_new_order"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:fitssystemwindows="true"     tools:context=".baseactivity">      <linearlayout         android:layout_width="match_parent"         android:layout_height="match_parent"         android:orientation="vertical">          <include layout="@layout/app_bar" />          <framelayout xmlns:android="http://schemas.android.com/apk/res/android"             android:id="@+id/drawer_layout"             android:layout_width="match_parent"             android:layout_height="match_parent">              <include layout="@layout/activity_content_base" />          </framelayout>     </linearlayout>      <!--place drawer-->     <framelayout         android:id="@+id/navweb"         android:layout_width="250dp"         android:layout_height="match_parent"         android:layout_gravity="right|end">          <include layout="@layout/drawer_test" />      </framelayout>  </android.support.v4.widget.drawerlayout> 

where layout/drawer_test cutom layout

try this:-

replace code(correct place in code):

<linearlayout         android:id="@+id/drawer_container"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_gravity="start"         android:layout_margin="1dp"         android:background="@drawable/rounded_corner"         android:orientation="vertical">          <linearlayout             android:layout_width="match_parent"             android:layout_height="match_parent"             android:layout_margin="10dp"             android:background="@drawable/rectangle"             android:orientation="horizontal"             android:weightsum="100">              <listview                 android:id="@+id/drawerlist"                 android:layout_width="0dp"                 android:layout_height="match_parent"                 android:layout_weight="50"                 android:choicemode="singlechoice"                 android:listselector="@drawable/list_selector" />              <webview                 android:id="@+id/webview"                 android:layout_width="0dp"                 android:layout_height="match_parent"                 android:layout_weight="50"                 android:background="#888888" />         </linearlayout>     </linearlayout> 

create 2 drawables, rectangle.xml

<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"     android:shape="rectangle">      <solid android:color="#ffffff"/>      <stroke         android:width="4dp"         android:color="@android:color/holo_red_light"/>      <padding         android:bottom="5dp"         android:left="5dp"         android:right="5dp"         android:top="5dp"/>  </shape> 

and rounded_corner.xml

<?xml version="1.0" encoding="utf-8"?> <shape     xmlns:android="http://schemas.android.com/apk/res/android"     android:shape="rectangle"   >      <solid         android:color="#ffffff" >     </solid>      <stroke         android:width="4dp"         android:color="@android:color/holo_red_light" >     </stroke>      <padding         android:left="5dp"         android:top="5dp"         android:right="5dp"         android:bottom="5dp"    >     </padding>      <corners         android:radius="10dp"   >     </corners>  </shape> 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -