In my application I do not want to use the actionbar or toolbar as my app is fairly simplistic and having one of those two would clutter my application. I know when using an actionbar with a navigation drawer there is an icon on the top left to show the drawer exists; however, I want a small notification icon in the middle of the screen to show that the drawer exists. Perhaps a clear arrow? Is this possible? I can not find any documentation on how I would approach doing this. Thank you.
Edit:
I do not want to use ANY type of action bar
Update 2
You can wrap your indicator in a RelativeLayout.
<RelativeLayout android:layout_width="match_parent"
android:layout_width="match_parent"/>
<MyIndicator
android:id="#+id/indicator"
android:layout_width="match_parent"
android:layout_width="match_parent"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"/>
<OtherView android:layout_width="match_parent"
android:layout_width="match_parent"/>
</RelativeLayout>
Update
Use FloatingActionButton from design library.
If you use a toolbar you can set a custom icon. Here is another post doing something like that: Custom icon in Android toolbar
You can use custom action bar in your app that can be customized according to your need.
Refer this link Custom Action Bar
Related
I'm a student making an application using an android studio for practice. I want to make seek bar in basic slide menu, which android studio provides as navigation drawer. I searched about it but couldn't find it. If the answer already exists, I apologise. Pretty hard to search by English...
Is there a way to create seek bar in slide menu so users can edit the value? For instance, users can control size or opacity of pen directly by editing the value of seek bar in slide menu. I made an example image. Thanks for reading.
Modify your NavigationView to accommodate android Views instead of menu.So that you can customize the entire Navigation Drawer Menu.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="#layout/nav_header_main" />
<ListView
android:id="#+id/lst_menu_items"
android:layout_width="match_parent"
android:layout_height="0dp"
android:entries="#array/sports_array"
android:layout_weight="1" />
</LinearLayout>
</android.support.design.widget.NavigationView>
I have created app with similar functionality to a browser. This is what I have right now:
Whenever user clicks on the edittext(the one with google.com inside it) i want to to take all of the space in actionbar covering overflow button and other icons(those are menu items as well).
Is there any way way I could do that? So far I have tried setting the layout-weight of the edittext to 1 but it does not work. The custom view inside actionbar is an linear layout like this one here:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/searchfield"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="match_parent"
android:background="#android:color/transparent"
android:imeOptions="actionGo"
android:inputType="textWebEmailAddress"
android:text="www.google.com" />
</LinearLayout>
I should also mention that i want to do it programatically.
Thanks guys
You can hide these icons by following topic: How do I hide a menu item in the actionbar?
I think you can easily hide the actionbar when click,
something like:
ActionBar actionBar = getActionBar(); //OR getSupportActionBar();
actionBar.hide();
Then bring it back when you need it by using:
actionBar.show();
I basically want to add a menu button to the far left of my action bar; like it does in the navigation drawer layout:
There must be an easy way to do this, all of the tutorials I am reading seem far to complicated for something that is already available for a application template.
Simplest solution: create a custom toolbar
Add a imageview and a textview to it.
<toolbar ...>
<imageview... /><--your image-->
</toolbar>
Or you can change Activity icon.
getActionBar().setIcon(R.drawable.my_icon);
I have a custom action bar for which I have used Sherlock Implementation and I tend to find that the tab widget is placed at the top every time rather than in the middle.
I have tried the following in XML but it seems to set the action bar at the top :
<TabWidget
android:id="#android:id/tabs"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_alignParentBottom="true"
></TabWidget>
I want it somewhere in the middle. I have provided with an example image below :
As you can clearly see that the action bar is located at the top which is not what I want. So,how do I place it after the Followers list. Any ideas ??
Is the parent View of you TabWidget a LinearLayout? If so, you may try your luck with a RelativeLayout.
I am not quite sure what kind of layout Gmail is using in Android.
I suppose they use a floating ViewGroup.
But for the menu on the top and bottom I really need somebody point me how to make that.
I suggest you to use the Sherlock ActionBar:
http://actionbarsherlock.com/
This allows you to easily develop an application with an action bar for every version of Android from 2.x and up.
In the sample app you can find the code to achieve what you are looking for under "Split Action Items". The idea is that you add actions from the menu as usual, but writting the following line in your manifest activity:
android:uiOptions="splitActionBarWhenNarrow"
You can create a menu which will sit on the bottom of a listview using the <RelativeLayout> tag like so
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ListView
android:layout_height="wrap_content"
android:layout_width="fill_parent" android:id="#android:id/list"
android:listSelector="#android:color/transparent"
android:layout_above="#+id/footer" />
<include android:id="#+id/footer" android:layout_height="wrap_content"
layout="#layout/mymenu" android:layout_width="fill_parent"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true" >
</include>
</RelativeLayout>
mymenu will contain a linearlayout with something like a tablelayout with a few rows (which can be textviews, imageviews, etc.) The table will sit at the bottom of your screen and the listview will be in a frame which starts at the top of the screen and ends at the top of the menu (no overlap)
You could also do the same for the top of the screen by simply having the listview say layout_below="#+id/header" instead of layout_above"#+id/footer" (or do both!)
This is covered on android. You have to implement a "split action bar". Note that it works in potrait view and disappears when you switch to landscape.
Android Action Bar
It looks like a custom ActionBar implementation. If you put icons in a normal ActionBar and there is not enough space to display them, android creates a bottom bar on its own and display the icons there.
I had a similar application and I chose to put my own custom bar there instead of implementing ActionBar