I want create a menu in my application which has no action bar... I want to make it just like you can see in chrome browser... Please help me with this and sorry for I don't have any code I made for this purpose ....Thanks in advance
I don't really get what you are asking, so I will try to list all posible meanings:
Use Toolbar(ActionBar)'s menu but layout doesn't have Toolbar:
Just add a toolbar to your layout:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</com.google.android.material.appbar.AppBarLayout>
...
</LinealLayout>
Custom Toolbar
I have never tried to inflate Menu into a non-Toolbar and I think it is not possible. Please correct me if you have tried! So I think you must implement every view/button, etc... one by one.
No toolbar, just menu (Popup ?)
https://www.geeksforgeeks.org/popup-menu-in-android-with-example/
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 want in my application to be able to implement this effect:
where the status bar is semi transparent and the layout is behind the status bar. Every example that I've read on the subject, was mainly associated with the navigation drawer and mostly used the ScrimInsetScrollView (or ScrimInsetsFrameLayout). I tried implementing this with ScrimInsetsFrameLayout.
Basically I have an activity that holds a fragment, and this is my layout (the fragment is later added to the container in the activity's onCreate method):
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:fitsSystemWindows="true"
>
<com.test.app.widget.ScrimInsetsFrameLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:insetForeground="#4000"
android:id="#+id/container"
></com.test.app.widget.ScrimInsetsFrameLayout>
</FrameLayout>
And also I've set the android:statusBarColor to transparent in themes.
The solution does not work for me. Apparently I am doing something wrong here.
Can someone point out where I am mistaken?
Have you tried
#Override
public void onCreate(Bundle savedInstanceState) {
getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
as described in the Android documentation
I want to show and hide the action bar /toolbar as the Google Play store app. I am using sliding tabs on top and view pager to show the content of each tab. Here is the screenshot of Google play store app for the reference:
My layout XML :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<LinearLayout style="#style/HeaderBar"
android:id="#+id/headerbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="#layout/toolbar_no_bg"
android:id="#+id/toolbar_actionbar"/>
<com.fauzie.sample.tabsspinner.widget.SlidingTabLayout
android:background="#color/tab_background"
android:id="#+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<android.support.v4.view.ViewPager
android:id="#+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/headerbar">
</android.support.v4.view.ViewPager>
</RelativeLayout>
Thanks in advance.
Have a look at this:
https://github.com/flavienlaurent/NotBoringActionBar
There's a trick involved here. You'll need to:
Wrap your layout in a list view
Add a fake header with the same height as your action bar large header
set your action bar overlay to true
Translate the real header when the list moves (i.e. when the fake header is scrolled).
It's a little bit complicated at first but once you understand it, you see how smart and obvious it all is. The link will give you all you need I hope.
I myself used that link to implement it in my own app and it works great.
Checkout this library: https://github.com/ksoichiro/Android-ObservableScrollView
this will definitely help you
Check this example to implement this with the new official Android Design Support Library:
https://github.com/chrisbanes/cheesesquare
I'd like to create an extra-information view similar to that of the Google Drive app (below) on a tablet. When the info button is clicked, this view slides in from the rightcontaining a layout. Another example would be the Google+ app with its notifications slide-out panel:. The SlidingLayer by 6Wunderkinder almost works, but doesn't fade a semi-black background over the views behind the "drawer" and I haven't found another library that does this.
If anybody has any suggestions/solutions please let me know!
Also, I've already looked at this question and none of the answers suggested there are correct either.
For posterity, here's the answer to this question. As Steve Benett's suggestion led me to discover, the correct way to do this is to use two DrawerLayouts, nested within each other like so:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/drawer_navigation_bar"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_sidebar"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="#+id/fragment_main_content"
android:name="MainContentFragment"
android:layout_height="match_parent"
android:layout_width="match_parent" />
<fragment
android:id="#+id/fragment_sidebar"
android:name="SidebarFragment"
android:layout_width="300dp"
android:layout_height="match_parent"
android:layout_gravity="end" />
</android.support.v4.widget.DrawerLayout>
<fragment
android:id="#+id/fragment_navigation_bar"
android:name="NavigationFragment"
android:layout_height="match_parent"
android:layout_width="300dp"
android:layout_gravity="start" />
</android.support.v4.widget.DrawerLayout>
The innermost DrawerLayout contains the main content of the Activity, whether it be a fragment or some other layout components. fragment_sidebar is the fragment that will be swiped out from the right. Then, on the top-level DrawerLayout you have the fragment_nagivation_bar which houses the left Drawer's ListView or whatever.
Then, in the Activity Java code you have:
mDrawerLayoutLeft= (DrawerLayout) findViewById(R.id.drawer_navigation_bar);
mDrawerLayoutRight = (DrawerLayout) findViewById(R.id.drawer_sidebar);
mDrawerLayoutLeft.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
mDrawerLayoutRight.setDrawerShadow(R.drawable.sidebar_shadow, GravityCompat.END);
An optional addition (but recommended, for consistency of UX) is to hide the other Drawer when one is opened, so your screen doesn't consist solely of Drawers.
I hope this has helped somebody!
This is the DrawerLayout. Have a look at the design guide, which illustrates the behavior well.
If you want to use / customize the "semi-black background" use DrawerLayout.setDrawerShadow() with a drawable. Google hands out a set of drawables here. Download the ActionBar Icon Pack and look for the drawable_shadow.9.png.
If you want that the menu appears from the right, set android:layout_gravity="end" as a property in the second child of the layout.