android-toolbar

Control the Toolbar icon with NavigationDrawer

ⅰ亾dé卋堺 提交于 2019-12-04 06:25:09
问题 I'm currently using within my app the android.support.v7.widget.Toolbar and android.support.v4.widget.DrawerLayout . Everything is working right, but there is a slight thing I want to change its behaviour. When I open the drawer, the whole drawer occupies the space of the Toolbar . It would be nice that the Toolbar stays on top, like in the Google Music app . How can I achieve that? But the most important thing isn't the previous. At first, the icon which is loaded in the application is the

How to set background of collapsing toolbar with custom behavior to fit whole screen

╄→尐↘猪︶ㄣ 提交于 2019-12-04 05:27:40
I'm following nice repo which shows how to make custom behavior of collapsing toolbar WhatsApp-ProfileCollapsingToolbar . What I don't like is when picture below toolbar (toolbar's font is white) is white then toolbar is not visible. So I'm trying to set background of toolbar to some color. First I added to widget_header_view.xml android:background="@android:color/holo_red_light" and now I have it like: <?xml version="1.0" encoding="utf-8"?> <com.anton46.whatsapp_profile.HeaderView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout

Adding two AppCompat Toolbars with different themes

≯℡__Kan透↙ 提交于 2019-12-04 03:38:46
问题 I would like to have two different android.support.v7.widget.Toolbars in my app, one dark, one light, and switch between them when needed. However, when I set a different theme on the second toolbar, it seems to reset the theme on the first toolbar as well. Is that a bug or intended behavior? Toolbar 1: <android.support.v7.widget.Toolbar xmlns:sothree="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main_toolbar" android

Show different menu options on Toolbar for activity and fragment

一个人想着一个人 提交于 2019-12-04 03:28:21
Android Studio 1.4 I have a Toolbar that I inflate in my activity_main.xml . I have a menu called main.xml that gets inflated that has just 1 icon to display on it. When the user clicks to open a fragment. I have another menu friends.xml that has 2 icons. When I inflate the friends menu in the fragment it still displays the icon from the main.xml menu. I thought that inflating a new menu on the toolbar would remove the existing menu. This is a screenshot of the main.xml menu. The find icon is displayed This is the screenshot of the fragment as you can see the find icon is still there. activity

Showing a menu overflow button in a Toolbar

↘锁芯ラ 提交于 2019-12-04 03:17:03
问题 I've created a Toolbar for Lollipop, but I can't seem to figure out how to add an overflow button to the toolbar. I'm not going to be using the v7 appcompat toolbar, as I want to explicitly use the Toolbar widget. I want it to look something like this: main_activity.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:fab="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation=

ViewPager with Toolbar and TabLayout has wrong height

陌路散爱 提交于 2019-12-03 23:54:41
I have a ViewPager below an AppBarLayout (with a Toolbar and a TabLayout). I cannot understand why the height of the loaded fragments is more than the available space, even if there are no elements so big, making the tab scrollable. This is the main layout xml: <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <android.support.design.widget.AppBarLayout android:layout_width="match

how to set toolbar on FragmentActivity?

泪湿孤枕 提交于 2019-12-03 23:35:43
I want to set toolbar on my activity which extends FragmentActivity . I know that for use setSuppoertActionBar(toolbar) method we extends AppCompatActivity instead of FragmentActivity but I override the onMenuItemSelected(int featureId, MenuItem item) method which is final in AppCompatActivity and final method cannot override. so I'm restricted to extends FragmentActivity . Here is my code: public class MainActivity extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar

Android 5.0 - How to implement this tablet layout from Material Design guidelines

对着背影说爱祢 提交于 2019-12-03 23:16:08
I am not getting it which is ActionBar and which is ToolBar. How do i implement this? Any answers appreciated..Thanks in Advance. In this example, the blue toolbar is an extended height, overlaid by the screen content and provides the navigation button. There is another toolbar used in the detail view. I have circled both Toolbars below. MathieuMaree Haven't tried this yet but it should work. Here is your layout : <?xml version="1.0" encoding="utf-8"?> <!-- The important thing to note here is the added fitSystemWindows --> <android.support.v4.widget.DrawerLayout android:id="@+id/drawer_layout"

Hiding Toolbar on scroll with recyclerview inside fragment

余生颓废 提交于 2019-12-03 22:12:35
I'm trying to get the toolbar to collapse on scroll when a recyclerview inside a fragment is scrolled. To start, heres my main layout: <DrawerLayout> <RelativeLayout android:id="@+id/mainRelativeLayout" android:layout_width="match_parent" android:layout_height="match_parent" > <android.support.design.widget.CoordinatorLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <android.support.design.widget.AppBarLayout android:id="@+id/appBarLayout" android:layout_width="match_parent" android:layout_height="wrap_content" > <Toolbar android:id="@+id/toolbar" android

How to implement android Toolbar Back button

≡放荡痞女 提交于 2019-12-03 20:39:00
问题 I am using a custom toolbar. I need to add back button to it. Now I am using this code to add the back button. Toolbar toolbar = (Toolbar) getActivity().findViewById(R.id.toolbar); toolbar.setBackgroundColor(getResources().getColor(R.color.white)); toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.back_arrow)); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); This works fine. I can see the back