android-toolbar

How to create Toolbar Tabs with ViewPager in material design

微笑、不失礼 提交于 2019-12-06 03:19:38
问题 Anyone know anything about how tabs are done in API 21/AppCompat Toolbar? A lot of materials and articles what I found were old. They used old methods with ActionBar which don`t work now. At this moment I just created toolbar and have no ideas about toolbar tabs. So can anyone give examples or articles about how to make toolbar tabs with viewpager? 回答1: Anyone know anything about how tabs are done in API 21/AppCompat Toolbar? There are no Toolbar tabs. The pattern of having tabs in the action

FrameLayout Shown Above AppBarLayout

强颜欢笑 提交于 2019-12-06 02:31:07
问题 I have a simple CoordinatorLayout with a AppBarLayout and FrameLayout , but the FrameLayout contents are being displayed over the AppBarLayout regardless of the layout_behavior attribute on the FrameLayout . I've tried adding that attribute elsewhere (like on my RecyclerView ), but it's the same behavior. Here's a picture to show what I mean. Activitiy Layout: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk

How to remove top and bottom padding from android.support.v7.widget.Toolbar?

随声附和 提交于 2019-12-06 00:34:41
问题 I am trying to place a SlidingTabLayout inside my android.support.v7.widget.Toolbar but for some reason there is extra top and bottom padding in portrait layout. As shown in this screenshot: In landscape layout the android.support.v7.widget.Toolbar is shorter and the extra padding is gone: I am aware of the contentInsertStart and contentInsetEnd attributes but there does not appear to be anything for top and bottom. Here is my layout: <android.support.design.widget.AppBarLayout xmlns:android=

How to fully mimic Action item view in the toolbar, for a customized one?

安稳与你 提交于 2019-12-05 21:01:53
Background I have an action item that's not quite standard. It has its own layout, because I've failed to create a nice Drawable for it (written about it here ). Basically, it's just a TextView with a background that wraps its short text that it shows. The problem Sadly I can't find a way of fully mimic it to look like normal ones: The ripple effect (and probably the simple clicking effect on older versions too) doesn't have the same color and size. There isn't a toast for when I long click on it Maybe other things I haven't noticed? Here are screenshots to demonstrate the differences: The new

Android Toolbar - Change height and width of Navigation Icon Programmatically

扶醉桌前 提交于 2019-12-05 16:14:58
I want to change height and width of Navigation Icon(in black circle in screen shot) in Android Toolbar programmatically. Is there any way to do so. This is not toolbar logo. I can't update toolbar theme in Styles xml as I want it to be dynamic. Please help. Yasin Kaçmaz I did this way : toolbar= (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); if(getSupportActionBar()!=null){ Drawable drawable= getResources().getDrawable(R.drawable.ic_sync_white_36dp); Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap(); Drawable newdrawable = new BitmapDrawable(getResources(), Bitmap

Change ToolBar default icon on the left

拥有回忆 提交于 2019-12-05 14:29:25
I am using a ToolBar at the top at present and want to replace the default back button with a home button. But when I add item, it always adds to the right. I don't see any layout_gravity options to choose either. Is there a way to do this? MainActivity Toolbar toolbar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_delete); toolbar = (Toolbar)findViewById(R.id.app_bar); setSupportActionBar(toolbar); getSupportActionBar().setTitle(" Testing"); getSupportActionBar().setDisplayHomeAsUpEnabled(true); }

Android: unable to change color of back arrow navigation icon

我与影子孤独终老i 提交于 2019-12-05 13:13:11
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/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr

ViewPager with Toolbar and TabLayout has wrong height

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 12:48:59
问题 I have a ViewPager below an AppBarLayout (with a Toolbar and a TabLayout). I cannot understand why the height of the loaded fragments is more than the available space, even if there are no elements so big, making the tab scrollable. This is the main layout xml: <android.support.design.widget.CoordinatorLayout 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="match_parent"

Custom layout in Toolbar with TabLayout below

筅森魡賤 提交于 2019-12-05 11:50:47
Right now, I have a normal looking Toolbar . What I want to do is add a custom layout between the Toolbar and the TabLayout , as shown in the picture below: On the left is what my Toolbar looks like now, and on the right is what I want it to look like. As you can see, I want to add an ImageView and two TextView s to the layout. How can I achieve this? Here is my current layout: <?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" android:id="@+id

How to hide toolbar after collapsing while recyclerView scrolling down

守給你的承諾、 提交于 2019-12-05 11:26:36
How to hide toolbar after collapsing while recyclerView scrolling down, show toolbar when recyclerView scrolling up, and expand CollapsingToolbarLayout at the end of list? Now CollapsingToolbarLayout just collapse, and toolbar is showing all time when scrolling. <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.android.com/tools" android:id="@+id/coordinatorlayout" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="