android-toolbar

Android Toolbar color change

◇◆丶佛笑我妖孽 提交于 2019-12-23 15:44:52
问题 I have an app which uses android.support.v7.widget.Toolbar . Every section of the app is a Fragment accessed through a support.v4.widget.DrawerLayout I need to change the Toolbar color depending on which section is shown (client particular needs). I defined some colors in the colors.xml so I can make something like: changeToolbarColor(R.color.section_one); /**/ private void changeToolbarColor(int color_res_id){ Integer colorTo = getResources().getColor(color_res_id); toolbar

CoordinatorLayout, AppBarLayout and ToolBar - Toolbar doesn't scroll off the screen

守給你的承諾、 提交于 2019-12-23 12:25:20
问题 I am trying to make my ToolBar scroll off the screen, when I scroll up my ViewPager(ViewPager is inside a fragment that is placed in FrameLayout) and show the ToolBar when I scroll down. I am trying to achieve this using the Support Design Library. Here is my XML: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas

Creating a custom toolbar in android

我们两清 提交于 2019-12-23 09:27:33
问题 I am trying to create a custom extended toolbar in android with an edit text in the toolbar. The layout that I want to implement looks something like this The code that I have written to implement is something like this: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen

Set toolbar title

此生再无相见时 提交于 2019-12-23 06:57:24
问题 I am trying to set my toolbar title like so: public class StatisticsPage extends Fragment { public StatisticsPage(){} private FragmentTabHost mTabHost; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.statistics_pagelayout, container, false); Spinner spinner = (Spinner) rootView.findViewById(R.id.statsSpin); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(),

How to set images and text in toolbar from fragment activities in android

随声附和 提交于 2019-12-23 05:07:05
问题 I need to set one imageView and Textview on the right side of toolbar in the navigationDrawer activity.But the thing is that the values for imageview and textviews are different for each fragment activity. And also I need to make the toolbar transparent.I am using default navigation drawer activity.Can anyone help? Any help will be appreciated. app_bar_main.xml file <? xml version = "1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android

Android - How to get parentActivityName attribute value programmatically?

梦想的初衷 提交于 2019-12-23 02:28:27
问题 An activity is declared in my manifest like this: <activity android:name=".TicketingHomeActivity" android:label="@string/title_activity_ticketing_home" android:parentActivityName=".HomeActivity" /> How can I get the value of android:parentActivityName programmatically? I need to do this as I have just replaced my ActionBar with a Toolbar, but getSupportActionBar().setDisplayShowHomeEnabled(true) is now showing the Up arrow in an activity even when there is no parentActivityName attribute set

Layout Jitter when Toolbar hides while scrolling RecyclerView

限于喜欢 提交于 2019-12-23 01:41:47
问题 Hi , I have a layout with Toolbar, PageSlidingTab and ViewPager. Inside ViewPager there is a fragment with RecyclerView. I want to hide the Toolbar as i scroll the RecyclerView. I have achieved it by adding the following code : toolbar = ((MyActivity)getActivity()).getToolbar(); mRecyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() { int toolbarMarginOffset = 0; private int dp(int inPixels){ return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, inPixels,

Layout Jitter when Toolbar hides while scrolling RecyclerView

僤鯓⒐⒋嵵緔 提交于 2019-12-23 01:41:35
问题 Hi , I have a layout with Toolbar, PageSlidingTab and ViewPager. Inside ViewPager there is a fragment with RecyclerView. I want to hide the Toolbar as i scroll the RecyclerView. I have achieved it by adding the following code : toolbar = ((MyActivity)getActivity()).getToolbar(); mRecyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() { int toolbarMarginOffset = 0; private int dp(int inPixels){ return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, inPixels,

No ripple on menu item if actionBar/Toolbar is white

坚强是说给别人听的谎言 提交于 2019-12-22 08:26:04
问题 I have white toolbar with menu item showed as action that is a black vector asset from material icons. There is no ripple effect on menu item click because ripple effect is also white. If toolbar background is changed to other color e.g blue, ripple appears. How to change menu item ripple color so it will be visible on white background? I was trying to change colorControlHighlight in AppTheme but it hasn't changed menu item ripple color. Style <style name="AppTheme" parent="Theme.AppCompat

Android: unable to change color of back arrow navigation icon

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-22 06:37:39
问题 I'm using new android appcompat toolbar. I need to set the same custom color to both burger icon and back arrow icons. Using drawerArrowStyle allows me to change burger icon but not the arrow. The issue is only on Lollipop devices, anything pre-lollipop is fine. Here is the code: Toolbar: <?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