android-toolbar

Android Toolbar Action icon not working

自闭症网瘾萝莉.ら 提交于 2019-12-25 04:43:07
问题 I have two Material Toolbars in my app, and I have two menu_main.xml and menu_main2.xml . The icon shows properly in both toolbars, but the action on one of the toolbar doesn't work. How can I fix it? protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Setup Toolbar toolbar = (Toolbar) findViewById(R.id.tool_bar); setSupportActionBar(toolbar); toolbar2 = (Toolbar) findViewById(R.id.tool_bar2); toolbar2.inflateMenu

Android Toolbar Action icon not working

落爺英雄遲暮 提交于 2019-12-25 04:43:04
问题 I have two Material Toolbars in my app, and I have two menu_main.xml and menu_main2.xml . The icon shows properly in both toolbars, but the action on one of the toolbar doesn't work. How can I fix it? protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Setup Toolbar toolbar = (Toolbar) findViewById(R.id.tool_bar); setSupportActionBar(toolbar); toolbar2 = (Toolbar) findViewById(R.id.tool_bar2); toolbar2.inflateMenu

Add an image to the toolbar in android

社会主义新天地 提交于 2019-12-25 04:00:31
问题 is it possible to add an image to toolbar without using "android.support.v7.widget.Toolbar"? i already finished the app using "android.support.constraint.ConstraintLayout". want add the logo on top-right side. enter image description here 回答1: Create Toolbar Layout app_toolbar.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr

android - Change Hamburger/Back icons color programaticaly during runtime

我与影子孤独终老i 提交于 2019-12-24 17:07:22
问题 I'm trying to change the style attribute "colorControlNormal" of my app programmaticaly and during runtime, but I didn't have any results. This property is the color that will tint the hamburger & back icons of the new Toolbar viewGroup. Beside, I'm using the v7 compatibility library. I heard that we cannot change app theme during runtime, but I'm looking for an answer, even if it's not so clean way. Thank you so much ! Edit : I juste figured that gmail is doing what i want, when you click on

Android, reusable toolbar for navigation - where to put code?

て烟熏妆下的殇ゞ 提交于 2019-12-24 12:46:36
问题 I want to implement a toolbar for navigation which appears at the bottom of almost all activities in my app. It will have a fixed amout of elements (four). Screenshot: (certain activities will still have their own toolbar at the top): In order to make it somewhat reusable, I've created a separate layout file for the toolbar which allows me to include it on multiple activities with: <include android:id="@+id/toolbar_main" layout="@layout/toolbar_main" /> Every item of the toolbar leads to

Xamarin Android CoordinatorLayout hide/show another layout than toolbar

扶醉桌前 提交于 2019-12-24 06:29:03
问题 I need a help with CoordinatorLayout... I need hide/show toolbar when scrolling and together with this hiding behavior I need make smaller text and hide another layout in my AppBarLayout... My layout looks like this: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:local="http://schemas.android.com/apk/res-auto" android:id="@+id/coordinatorLayout" android:layout_width="match_parent" android

How to change Toolbar Color with different views?

前提是你 提交于 2019-12-24 03:44:18
问题 I am setting up my Toolbar in my main activity and trying to change the background color with different fragments. So basically, I am trying to access the Toolbar object inside fragment and set different background color. Few things which I have tried to do is : Access toolbar like: ((ActionBarActivity)getActivity()).getSupportActionBar().setBackgroundColor(XXX); But I am unable to access the setBackgroundColor function inside fragment. It is perfectly working inside the Main Activity. 回答1:

RelativeLayout is not matching parent width inside a ToolBar

感情迁移 提交于 2019-12-24 03:15:08
问题 So I have a customized toolbar on my home screen, and within this toolbar is a RelativeLayout . I have the layout width set to match_parent and the parent of the relative layout is just the width of the screen. For some reason, it does not fit the width of the screen because the left edge is some distance away from the edge of the screen. I am not sure why this is but it is making positioning within the RelativeLayout a bit more difficult. This is my .xml <android.support.v7.widget.Toolbar

How to add Toolbar to a fragment in android?

十年热恋 提交于 2019-12-23 23:24:07
问题 I have a fragment named as HomeFragment.java and it extends Fragment class. import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.example.android.test.R; import android.support.v7.app.ActionBarActivity; import android.support.v7.widget.Toolbar; public class HomeFragment extends Fragment { private Toolbar toolbar; public View onCreateView

How to set my toolbar fixed while scrolling android

好久不见. 提交于 2019-12-23 17:18:45
问题 I am currently working in e-commerce android app, i need to fix the toolbar while scrolling. As i attached the screenshot below. while scrolling the action bar need to be fixed and the body content scroll behind the toolbar Here is the layout xml: <LinearLayout android:id="@+id/container_toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <include android:id="@+id/toolbar_reg" layout="@layout/app_bar" /> </LinearLayout> <ScrollView