android-toolbar

How to click views behind a Toolbar?

折月煮酒 提交于 2019-11-30 22:59:12
问题 I have a toolbar with a transparent/translucent background that overlays the content. So, behind the toolbar, views can appear that are clickable. The problem is that they can not be clicked through the toolbar because the toolbar is catching the click event. I tried setting android:clickable="false" , android:focusable="false" and android:focusableInTouchMode="false" for the toolbar, but it has no effect. How can I send a click through the toolbar to the underlying view? 回答1: Take a look at

Android Material with Extended Toolbar

强颜欢笑 提交于 2019-11-30 22:35:51
I'm testing material design and i'm developing an app using extended toolbar. My app is very simple: The main activity extends ActionBarActivity and my layout looks like: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".WeatherActivity" android:orientation="vertical"> <android.support.v7.widget.Toolbar xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/my_toolbar" android:layout_height="128dp" popupTheme="@style

Change Toolbar background color programmatically does not change Toolbar Title Background color

狂风中的少年 提交于 2019-11-30 22:31:01
问题 I´m trying to change the toolbar Background color programmatically by doing this: getSupportActionBar().setBackgroundDrawable(newColorDrawable(getResources().getColor(R.color.test_color_blue))); And this is the result: before: After: Some how the toolbar title still has the same background color as before. here is my toolbar xml: <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout

Elevation on AppBarLayout doesn't work

亡梦爱人 提交于 2019-11-30 22:19:34
When I try to set a specific value to elevation for AppBarLayout, the shadow disappears completely. <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" app:elevation="4dp"> <!-- Toolbar --> <android.support.v7.widget.Toolbar... <!-- Other Layouts --> </android.support.design.widget.AppBarLayout> Is this a bug or the expected behaviour? I'm using the version 26.0.0 of the design library. Setting Property Animation Creating an animation with 1ms of execution time: /animator/appbar_elevation.xml <?xml version="1.0" encoding="utf-8"?

AppCompat v7 Toolbar Up/Back Arrow Not Working

橙三吉。 提交于 2019-11-30 20:41:29
I have two fragments in an activity. When fragment A is showing, I want the navigation drawer burger icon to show and the navigation drawer to work. When fragment B is showing, I want the back arrow to show and when it's clicked do an up navigation. However, I can't seem to get the new AppCompat v7 toolbar to show the up arrow at all inside my ActionBarActivity unless the nav drawer is open. In my activity, for my onCreate() method I have... toolbar = (Toolbar) findViewById(R.id.toolbar); if (toolbar != null) { setSupportActionBar(toolbar); } mDrawerLayout = (DrawerLayout) findViewById(R.id

Android toolbar setNavigationIcon not working

北城以北 提交于 2019-11-30 20:21:07
So, I have a BaseActivity in which I have a toolbar and I call setSupportActionBar(toolbar). In some of my activities that extends BaseActivity, I would like to change the navigation icon (the default arrow) to another drawable. But when I call toolbar.setNavigationIcon(myDrawable) it doesn't work, it still shows the default left pointing arrow icon. Any idea? Thanks. I think you can set like this menuDrawerToggle = new ActionBarDrawerToggle(this, menuDrawer, toolbar, R.string.drawer_open, R.string.drawer_close){...} menuDrawerToggle.syncState(); toolbar.setNavigationIcon(getResources()

Spinner Theme is dark in Android

血红的双手。 提交于 2019-11-30 19:55:59
I am trying to change the toolbar spinner dropdown theme strangely this is not happening. It is coming up always dark when I click on the spinner. I would like to have the background grey and text black. I don't have any actionbar. I am setting everything through toolbar. Hence I tried the following: <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:local="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android

Android lollipop toolbar switch between open/close drawer and back button

家住魔仙堡 提交于 2019-11-30 19:34:56
I had standart navigation drawer, but now i'm trying to modify it, using toolbar. Earlier my code looked like: MainActivity.java @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Log.v("MAIN", "CREATE"); initViews(); setListeners(); getFragmentManager().addOnBackStackChangedListener(new FragmentManager.OnBackStackChangedListener() { @Override public void onBackStackChanged() { shouldDisplayHomeUp(); } }); mNavigationDrawerFragment = (NavigationDrawerFragment) getFragmentManager().findFragmentById(R.id

Marquee title in Toolbar / ActionBar in Android with Lollipop SDK?

风流意气都作罢 提交于 2019-11-30 19:28:52
I've tried several different approaches, including the one found here (which in turn led me to trying both of the top answers to this question), as well as using reflection to get access to the TextView and setting the relevant methods. Both attempts failed, the former resulting in no text at all being set to the title (and I was setting the text to the proper textview element), the latter setting the text and removing the ellipse, but not marqueeing at all. Below is my reflection attempt. import android.content.Context; import android.support.v7.widget.Toolbar; import android.text.TextUtils;

Up Navigation (Action Bar's back arrow) is not working for fragments

℡╲_俬逩灬. 提交于 2019-11-30 19:14:30
I've drawer-layout as a base layout of my activity and I'm replacing two fragments on a frame present inside this drawer-layout. The first fragment is not added in fragment's back stack. I'm displaying hamburger icon in my activity (I also want the drawer menu in my first fragment). In second fragment I disabled the hamburger icon by mActionBarDrawerToggle.setDrawerIndicatorEnabled(false) and enabled back button using actionBar.setDisplayHomeAsUpEnabled(true) . In first fragments onResume I enabled hamburger icon by mActionBarDrawerToggle.setDrawerIndicatorEnabled(true)` so that when user