android-toolbar

Can't use android.support.v7.widget.Toolbar with android.useAndroidX=true

半世苍凉 提交于 2020-01-24 20:47:07
问题 in app/build.gradle: implementation 'com.android.support:appcompat-v7:28.0.0' in my activity I use import android.support.v7.widget.Toolbar Nice. It's work finde. But when I migrate to androidx I add this: android.useAndroidX=true android.enableJetifier=true As result now my activity not compile with error: import android.support.v7.widget.Toolbar; Cannot resolve symbol 'v7' Is it possible to use android.support.v7.widget.Toolbar together with anrdoidx.* package? 回答1: Since you are migrating

How to put all action items on the left, taking as much space as possible, and yet have overflow on the right?

纵饮孤独 提交于 2020-01-24 09:38:07
问题 Background Suppose I have a Toolbar, and multiple action items. Some might be customized (example: TextView with image). What I need to do is to align them all to the left, instead of to the right, yet still have the overflow item on the right side. I also try to have as much space as possible to the action items. The problem None of what I've found works What I've tried 1.For the alignment, I've found some solutions on StackOverflow, of adding views inside the Toolbar, but this won't work

How to make toolbar with rounded corners and elevation inside appbarlayout? Like this picture

喜欢而已 提交于 2020-01-24 04:34:06
问题 This is my code that I try to create toolbar with rounded corners shown in picture. <android.support.design.widget.AppBarLayout android:id="@+id/appBar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="12dp" android:background="@android:color/transparent"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/bg_actionbar" /> </android

How to make toolbar on Android takes a full width?

Deadly 提交于 2020-01-24 04:15:15
问题 Here is the result: http://i.stack.imgur.com/VgbZT.png. I want it to be right below status bar and full width, just like this one: http://i.stack.imgur.com/FFQJN.png. <RelativeLayout 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" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="

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

孤者浪人 提交于 2020-01-22 20:09:27
问题 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

(Design Support Library) CollapsingToolbarLayout — Toolbar not getting pinned on collapse

余生颓废 提交于 2020-01-22 09:00:26
问题 I'm having trouble integrating the Design Support Library into my application. For some reason, the toolbar collapses with the CollapsingToolbarLayout, and does not leave it pinned like in the Cheesesquare example by Chris Banes. https://github.com/chrisbanes/cheesesquare I didn't do anything different to my layout. In fact, I replaced my styles with his, and dropped in his layout. I wonder if using Toolbar, instead of android.support.v7.widget.Toolbar is causing this. Here is the problem.

Android Toolbar actionLayout of Switch causes text to jump when menu is pressed

我是研究僧i 提交于 2020-01-21 05:26:05
问题 Please refer to my project at: https://github.com/paulpv/ToolbarSwitch I am working on a simple custom layout for the Android Toolbar (aka: new ActionBar). This simple control adds a Switch to the Toolbar, and can be seen here highlighted in magenta: My problem is that immediately when the overflow menu is pressed, the Switch's Text jumps to the top of the Toolbar, and remains that way when you close the overflow menu: A similar thing happens in Landscape orientation (the subtle difference

Missing Up navigation icon after switching from ICS ActionBar to Lollipop Toolbar

蓝咒 提交于 2020-01-20 18:48:27
问题 I have an activity with many fragments that uses action bar and navigation drawer. It has "home as up" enabled. I have implemented proper logic that only top level fragments show action bar drawer toggle icon, other fragments show up arrow. I achieved this by: mDrawerToggle.setDrawerIndicatorEnabled(false); mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, mDrawerList); Now old v4 support library ActionBarDrawerToggle became deprecated. I've switched to v7 version together

Change Toolbar Menu Item color (non-hidden action)

五迷三道 提交于 2020-01-19 06:52:47
问题 Say I have a menu (options_menu.xml) similar to the following: <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" > <item android:id="@+id/action_login" android:title="Login" app:showAsAction="always"/> </menu> which I inflate into the new Toolbar item mToolbar.inflateMenu(R.menu.options_home); This results in something like Is there a way to change this text color without using an image, changing the rest of the Toolbar text

android.support.v7.widget.Toolbar VectorDrawableCompat IllegalStateException when using support lib 24+

末鹿安然 提交于 2020-01-15 04:50:10
问题 I've started a new project in Android Studio and configured my gradle build settings. When I add an android.support.v7.widget.Toolbar to a layout, I get the following error when in design view. Keep note that this error only shows up when previewing with an API less than 21 (specifically APIs 16 - 19). Everything works fine when I preview with API 21 - 24. I have looked at a number of solutions and tried them, but none have solved the issue. One thing I tried doing was adding this to my