android-toolbar

Add elevation/shadow on toolbar for pre-lollipop devices

亡梦爱人 提交于 2019-12-27 17:04:00
问题 I updated my android app to the new material design, but I also wanted to add some shadow or elevation to the Toolbar. There seem to be some (hacky) ways of doing it via images/9-patches, but I wonder if it can be done via the support libraries. (just like the CardView can have elevation) According to this answer on another question, this is possible by wrapping the Toolbar in a AppBarLayout , but this doesn't work for me. My layout: <?xml version="1.0" encoding="utf-8"?> <android.support

Android black and white theme

守給你的承諾、 提交于 2019-12-26 10:46:47
问题 i am trying to achieve theme like this but i can't find any help about it i am trying to get white action bar with black icons and text and status bar with black icons and white background I am changing color pragmatically but I think there is some proper theme to get something like this i have also tried material.theme.light 回答1: Here is your Solution Try this <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk

Android black and white theme

て烟熏妆下的殇ゞ 提交于 2019-12-26 10:46:33
问题 i am trying to achieve theme like this but i can't find any help about it i am trying to get white action bar with black icons and text and status bar with black icons and white background I am changing color pragmatically but I think there is some proper theme to get something like this i have also tried material.theme.light 回答1: Here is your Solution Try this <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk

Why doesn't my Lollipop ActionBar show any color (essentially colorPrimary)?

↘锁芯ラ 提交于 2019-12-25 13:10:33
问题 I wrote this SSCCE to demonstrate the problem. The emulator is NexusFive but it is customised to use API22. SSCCE res/values/colors.xml <?xml version="1.0" encoding="utf-8"?> <resources> <color name="primaryColor">#69F0AE</color> <!-- Light ferozi --> <color name="primaryColorDark">#00E676</color> <!-- Darker Ferozi --> <color name="accentColor">#F44336</color> <!-- Red 500 --> </resources> res/values/styles.xml <resources> <style name="AppBaseTheme" parent="Theme.AppCompat"></style> <style

Working with OptionsMenu in nested fragment not updating

吃可爱长大的小学妹 提交于 2019-12-25 09:18:53
问题 I displayed a fragment A that implements a ViewPager with several fragments (nested fragments). In my nested fragments, I inflate a menu with the following method. @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.my_menu, menu); super.onCreateOptionsMenu(menu, inflater); } This question was already asked here. And i tried all the answers its not working. My issue is Everything working fine.but when i open another fragment(it have not any

How to remove gap between Toolbar and layout underneath

五迷三道 提交于 2019-12-25 09:00:02
问题 Tried implementing a toolbar for my layout but a gap keeps appearing underneath it. What is the correct way to eliminated that gap? I believe android:fitsSystemWindows="false" or android:fitsSystemWindows="true" but I'm not entirely sure which code needs to be used as I've heard several different solutions. Also I'm not sure where it needs to go. Fragment XML code <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android

Asynctask getActivity

女生的网名这么多〃 提交于 2019-12-25 07:58:40
问题 I am trying to set my toolbar title from an async task. I am getting a cannot resolve method getActivity() in this line: ((ActionBarActivity)getActivity()).getSupportActionBar().setTitle(name); My code looks like this: /** * Created by Mike on 2/28/15. */ import android.app.Activity; import android.app.Dialog; import android.app.ProgressDialog; import android.content.Context; import android.content.SharedPreferences; import android.os.AsyncTask; import android.preference.PreferenceManager;

Toolbar title changes on rotation on device to entered text in an EditText?

六眼飞鱼酱① 提交于 2019-12-25 07:24:26
问题 I have an editText directly under my Toolbar . But when my device rotates, the Toolbar's title, (set by XML) changes to the editText 's current text. <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="@color/colorPrimary" android:theme="@style/ThemeOverlay.AppCompat.ActionBar" app:popupTheme="@style/ThemeOverlay.AppCompat.Light"> <TextView android:id="@+id/title" android:layout_width=

How can i display an emoji in the Toolbar title?

为君一笑 提交于 2019-12-25 07:21:39
问题 I have an emoji(ex: "\U0001F610") and I'd like to display it in the toolbar title. It works well in a TextView, but it doesn't seem to work for the toolbar. Can you give me any advice on how to do it properly? 回答1: ActionBar.Title = "\uD83D\uDE03"; ActionBar.Title = "\uD83D\uDE03" + "\uD83D\uDE0F" + "\uD83D\uDE10"; 来源: https://stackoverflow.com/questions/38396429/how-can-i-display-an-emoji-in-the-toolbar-title

android toolbar is hidden when Tabs are implemented

独自空忆成欢 提交于 2019-12-25 04:44:28
问题 I've created an app interface material design toolbar,drawer,fab everything works. Then I wanted to add 2 tabs ,so I used https://github.com/neokree/MaterialTabs library.Now the fragments and swipe action works .But the toolbar is now disappeared and tabHost is in place of it. In Android studio design view(not avd) it shows but when it came to real device(kitkat) it is not. I don't know what's wrong I've implemented the same way as in the test in lib module. <android.support.v4.widget