android-toolbar

Change TextColor in SearchView using Android Toolbar

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-20 18:43:14
问题 I have the following problem. I've setup my Actionbar to use a Toolbar instead using the API 21 with the appcompat-v7:21. The textColorPrimary style tag is configured to use the color @android:color/white , so all the titles in the new Android Toolbar will have a white text color (so far so good). Now I´ve added a SearchView, and setup a custom background to it like this: <style name="AppTheme.Base" parent="Theme.AppCompat.Light"> <item name="colorPrimary">@color/action_bar_background</item>

AppBarLayout + TabLayout + CollapsingToolbarLayout + SwipeToRefresh

怎甘沉沦 提交于 2019-12-20 10:53:16
问题 I met a lot of issues related with my problem but nobody I found wanted the behaviour I'm looking for. I want a view pager with tabs and app bar, when the contained fragments are scrollable and are scrolled (toward bottom), I want the app bar to disapear but leave the tabs, when scrolled toward top, to re-apear. some of these fragments contain a SwipeToRefresh Layout (sometimes it causes problems). I tried a lot of configurations that always leave something wrong. for now I don't have the

AppBarLayout + TabLayout + CollapsingToolbarLayout + SwipeToRefresh

故事扮演 提交于 2019-12-20 10:53:08
问题 I met a lot of issues related with my problem but nobody I found wanted the behaviour I'm looking for. I want a view pager with tabs and app bar, when the contained fragments are scrollable and are scrolled (toward bottom), I want the app bar to disapear but leave the tabs, when scrolled toward top, to re-apear. some of these fragments contain a SwipeToRefresh Layout (sometimes it causes problems). I tried a lot of configurations that always leave something wrong. for now I don't have the

getSupportActionBar().setTitle() vs toolbar.setTitle()

微笑、不失礼 提交于 2019-12-20 10:11:37
问题 I am aware that there are two methods to setting a title in an Android Activity . Assuming I already have the following code... @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.my_activity); ... Toolbar toolbar = (Toolbar) findViewById(R.id.my_toolbar); setSupportActionBar(toolbar); ...I can use either this... getSupportActionBar().setTitle("My title"); ...or this... toolbar.setTitle("My title"); ...to set my title. My

Extended Toolbar with Custom View not Displaying with Full Width

旧城冷巷雨未停 提交于 2019-12-20 10:05:38
问题 I went through lots of answers here related to Toolbar but none of the answers could help me. What I'm trying to achieve is to have an extended toolbar whhich will display a logo, possibly a name of the Activity/App, it will have an action button/drawer toggle to the right that will display a navigation-like drawer to the right, an overflow menu with other options like settings and also a navigation Tab at the bottom that will allow the user to move between different fragments (different days

Inflating AppBarLayout with Toolbar + TabLayout

让人想犯罪 __ 提交于 2019-12-20 08:36:08
问题 I currently have a DrawerLayout in my main.xml. There's a Toolbar wrapped in an AppBarLayout, and then a simple LinearLayout to swap out fragments. One of the fragments I navigate to, I want it to contain a TabLayout for a ViewPager of fragments. Currently, I have both of these in the fragment's layout file, but this causes a drop shadow to appear between the Toolbar and the TabLayout, which is something I don't want. I also don't want to use setElevation() because it won't work for pre

How can I change my custom toolbar icon dynamically

随声附和 提交于 2019-12-20 07:44:01
问题 In my application I'm using toolbar which having imageview in it. I need to change that imageview dynamically . Here is my toolbar.xml : <?xml version="1.0" encoding="utf-8"?> <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_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" android:background="@color/white" android:id="@+id/toolbar"

Toolbar header's item alignment issue?

旧时模样 提交于 2019-12-20 07:37:32
问题 Today i have stucked in one of the weird problem in Toolbar custom header. I am using the TextView in the center and ImageView which is at the right of the Toolbar . So i have used below lines of code in xml , please check it once. <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/white" android:theme="@style/AppTheme.NoActionBar.AppBarOverlay"> <LinearLayout xmlns:android="http://schemas

Tile not getting center in Collapsed toolbar

别来无恙 提交于 2019-12-20 07:19:04
问题 I tried setting collapsingToolbarLayout.setCollapsedTitleGravity(Gravity.CENTER); collapsingToolbarLayout.setExpandedTitleGravity(Gravity.CENTER); and almost all available links on INTERNET but i am not able to put the title in center of toolbar . plz help ! 回答1: make your Toolbar like this <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:contentInsetEnd="0dp

Android Toolbar instead of action bar

我是研究僧i 提交于 2019-12-19 10:29:27
问题 I'm trying to use Toolbar instead of ActionBar. In Android 5.0.+ it works but in 4.4 the status bar is placed on top of the Toolbar. Screenshot: Layout: <android.support.v7.widget.Toolbar xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" android