how to change the position of arrow in actionbar - android

I'm developing a slide menu in the action bar.
I downloaded slide menu source code from GitHub, but I can't change the position of the action bar icon.
The action bar is positioned to the left and I want to place it on the right.
How would you recommend I go about changing *action bar icon(ex.arrow icom)*?

You need your slide menu to be opened from right side
Then you should do somtthing like this in your code :
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<FrameLayout
android:id="#+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- The navigation drawer, setting gravity to "end" means "right" but preferabbly use "end"-->
<ListView android:id="#+id/right_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:choiceMode="singleChoice"
android:divider="#android:color/transparent"
android:dividerHeight="0dp"
android:background="#111"/>
When you change your xml like this, i think your sliding menu will open/close from Right side
Thanks

Related

How To User Image and User Name In Sliding Menu

I M new On Android
I created Sliding Menu Drawer Using Actionbar sherlock Library
Its Working Fine But I want Show User Logged Image and His Name ..with Layout On Top Of Sliding Menu Drawer .i really want to create But I failed To create ..Please Help me tell Me How TO Create Which I want ..please
i will Appreciate answer
thanks in advance
i want To Show Sliding Menu Like This image Example
Please consider this example
http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/
It shows you how to implement a Navigation Drawer with a ListView handled by a BaseAdapter. At the very beginning it tells you to define the layout for your Drawer. Here you can add the layout of your Logged In Name.
activity_main.xml
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Framelayout to display Fragments -->
<FrameLayout
android:id="#+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- ADD YOUR LAYOUT HERE!!-->
<ListView
android:id="#+id/list_slidermenu"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="#color/list_divider"
android:dividerHeight="1dp"
android:listSelector="#drawable/list_selector"
android:background="#color/list_background"/>
</android.support.v4.widget.DrawerLayout>
For the rest please follow the tutorial in the link.

changing the list view of navigation drawer

I have a navigation drawer and I have 5 items in that. What I want to do is I want the first 3 items in the list to display from the top than a gap in between and the next two items to be displayed from the bottom of the drawer.
How can I do this?
Basically I want to how can I customise my drawer.
I also want to know from where I can make icons for my navigation drawer.
Here the snapshot to my drawer
link
I suppose this post will help you :) Just change DrawerLayout and put here whatever you want
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- Relativelayout to display Lists -->
<RelativeLayout
android:id="#+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- Listview to display on top slider menu -->
<ListView
android:id="#+id/list_top_slidermenu"
android:layout_width="240dp"
android:layout_height="300dp"
android:layout_alignParentTop="true"
android:layout_gravity="start"
android:background="#color/list_background"
android:choiceMode="singleChoice"
android:divider="#color/list_divider"
android:dividerHeight="1dp"
android:listSelector="#drawable/list_selector" />
<!-- Listview to display on bottom slider menu -->
<ListView
android:id="#+id/list_bottom_slidermenu"
android:layout_width="240dp"
android:layout_height="100dp"
android:layout_alignParentBottom="true"
android:layout_gravity="start"
android:background="#color/list_background"
android:choiceMode="singleChoice"
android:divider="#color/list_divider"
android:dividerHeight="1dp"
android:listSelector="#drawable/list_selector" />
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
I think you need to use a custom adapter like always when you want to have something different from standard. There you can add customs views as well.
See my answer here https://stackoverflow.com/a/25086380/2777381. this is a sample of an custom adapter.
My idea would be to ad 3 custom listview items, with your icon, then an emty view with specific height. and then again some more custom list items.
Edit:
Sample of an "empty" View which i use as separator line:
<View
android:id="#+id/viewSeparator"
android:layout_below="#id/linearLayoutDrive"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="20dp"
android:background="#color/separator"/>

gmail like Progress bar functionality

I am creating a gmail like progress bar functionality. There seems to be some space between the actionbar and the progress bar.
Following is the code
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- As the main content view, the view below consumes the entire
space available using match_parent in both dimensions. -->
<FrameLayout
android:id="#+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ProgressBar
android:id="#+id/progressBar1"
style="?android:attr/progressBarStyleHorizontal"
android:indeterminateOnly="true"
android:layout_width="wrap_content"
android:layout_height="?android:attr/actionBarSize" />
<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"
android:background="#111"/>
</android.support.v4.widget.DrawerLayout>
DrawerLayout should contain only two children: FrameLayout for your content and fragment for drawer. Thus ProgressBar should be located inside dynamically created content.
To add a navigation drawer, declare your user interface with a DrawerLayout object as the root view of your layout. Inside the DrawerLayout, add one view that contains the main content for the screen (your primary layout when the drawer is hidden) and another view that contains the contents of the navigation drawer. for more Creating a Navigation Drawer.

Frame Layout fades away when opening navigation drawer

I am developing a mobile app in android for listing the most recent news. I have implemented the navigation drawer to select the categories. For this I have used fragments and frame layout. When I open navigation drawer the layout in the background seem to fade away or the screen brightennes gets darker.
Is there a way to make me possible to open the navigation drawer without fading away the frame layout.(in xml file or programatically)
I cant post pictures ( because of my low reputation number) but if it helps below is my xml file.
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- Framelayout to display Fragments -->
<FrameLayout
android:id="#+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
<!-- Listview to display slider menu -->
<ListView
android:id="#+id/list_slidermenu"
android:layout_width="240dp"
android:layout_height="fill_parent"
android:layout_gravity="start"
android:background="#color/time_al_blue"
android:choiceMode="singleChoice"
android:listSelector="#drawable/list_selector"
android:paddingTop="15dp" />
</android.support.v4.widget.DrawerLayout>
That shadow is called the scrim color.
You want to make it transparent, so your content is not obscured, i.e.
mDrawerLayout.setScrimColor(Color.TRANSPARENT);
If you want to do that it would be best if you use Sliding Menu from Jeremy Feinstein
Here you can find an implementation of his library and if you like this solution you can use it to replace navigation drawer.

Navigation drawer like Google+

How can I create a navigation drawer like Google+ where there is a header for user profile info and a listview below?
I have the following code in my Activity:
<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.br.app.MainActivity">
<FrameLayout
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<fragment android:id="#+id/navigation_drawer"
android:layout_width="#dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:name="com.br.app.NavigationDrawerFragment" />
</android.support.v4.widget.DrawerLayout>
Currently, the NavigationDrawerFragment contains just a listview, but I tried to add a RelativeLayout as a container with an inner RelativeLayout to create the profile area and the listview below, but the app is crashing.
I've read the tutorial from but as I could understand, my header would be an item of the listview, and it won't be fixed on top (without scrolling).
How can I create this custom navigation drawer like Google+?
Actually, there are two version of navigation drawer used by google.
the first is the old navigation drawer BELOW the action bar. It is used in Google Play Store and Google Books for example.
HERE you can find a library that implements it.
The second is the new navigation drawer that is showed in Material Design guidelines where the drawer is over the action bar.
HERE you can find a library that implements it.
Actually these two libraries are in developing. But they are almost usable at this time.
You can easily customize the android Navigation drawer once you know how its implemented. here is a nice tutorial where you can set it up.
This will be the structure of your mainXML:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Framelayout to display Fragments -->
<FrameLayout
android:id="#+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- Listview to display slider menu -->
<ListView
android:id="#+id/list_slidermenu"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:choiceMode="singleChoice"
android:divider="#color/list_divider"
android:dividerHeight="1dp"
android:listSelector="#drawable/list_selector"
android:background="#color/list_background"/>
</android.support.v4.widget.DrawerLayout>

Categories

Resources