android-design-library

How to enable horizontal scroll in tab like Google Play?

时间秒杀一切 提交于 2019-11-30 07:52:41
I'm referencing a great demo here regarding material design. It has tabs, but when I add too many the tab items get squished (see screenshot). How can I make it scroll horizontally? I believe below is the layout I should make the change, but I combed the docs and can't seem to get it, pls help! <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/main_content" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget

How to add submenu items to NavigationView programmatically instead of menu xml

纵饮孤独 提交于 2019-11-30 07:17:55
I'm trying to add submenu items to NavigationView programmatically . I'm able to add items into menu but not into submenu Adding items to menu works Menu menu = mNavigationView.getMenu(); menu.add(Menu.NONE, Menu.NONE, index, "Menu Item1"); But adding items to sub menu doesn't work Menu menu = mNavigationView.getMenu(); SubMenu subMenu = menu.addSubMenu("Sub menu title"); subMenu.add(Menu.NONE, Menu.NONE, index, "SubMenu Item1"); The trick to call BaseAdapter.notifyDataSetChanged on the underlying Adapter that contains the menu items. You could use reflection to grab the ListView or just loop

Pass scroll event to another view

孤街浪徒 提交于 2019-11-30 07:03:58
I have been using android design support library for collapsing toolbar layout. Everything works fine except that I want to scroll the whole view on scrolling content in collapsingBarlayout Here's the xml layout : <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <android.support.design.widget.CoordinatorLayout android

How to get the new NavigationView to play nice with status bar scrim?

自古美人都是妖i 提交于 2019-11-30 06:50:52
I've been playing with Google's new design support library and it's a blast! I'm just a little stumped though on the navigation view. All the things I read say that the NavigationView is smart enough to handle transparent scrim on its own. (The android-developers post, for one; search for scrim). Anyway, when I tried to do it I get the following result: Which is great; Exactly what I want. Except for one thing. When the drawer is closed, the scrim is an ugly dark grey, not my primaryColorDark . . . Here's my layout: <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android

CollapsingToolbarLayout and TabLayout

你。 提交于 2019-11-30 06:45:14
I'm trying to create an activity that has a CollapsingToolbarLayout with an image and toolbar (like in the CheeseDetailActivity in the cheesesquare example here ), that also has a tab layout below. Any ideas how to implement it? When trying to add it to the CollapsingToolbarLayout or the AppBarLayout, the result is that the tab layout is in the top of the screen Try this structure: <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

CoordinatorLayout(AppbarLayout) does not draw toolbar properly

限于喜欢 提交于 2019-11-30 06:26:59
I am using the new design support library to achieve scroll to hide toolbar. However, every thing works well if I don't load images by picasso. If I load images, sometimes when I scroll down to let toolbar show again, my toolbar become a blank white rectangle. Note that in this situation I still can press the navigation toggle to open the drawer, although it is not draw(show) on the screen: https://www.dropbox.com/s/nte3pr091nt2wfx/device-2015-05-30-093222.png?dl=0 But sometimes it works well: https://www.dropbox.com/s/i3u87df4x48fhj6/device-2015-05-30-094217.png?dl=0 I am so confusing about

Could not initialize class android.support.design.widget.CoordinatorLayout

我怕爱的太早我们不能终老 提交于 2019-11-30 06:01:08
问题 I am trying to use the CoordinatorLayout from the new Android design library. I added the package to gradle; then I try to use the layout I get this error: java.lang.NoClassDefFoundError: Could not initialize class android.support.design.widget.CoordinatorLayout at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance

Prevent RecyclerView from scrolling under AppBarLayout before AppBarLayout is collapsed

牧云@^-^@ 提交于 2019-11-30 05:19:54
问题 I'm creating a RecyclerView with header where the header collapses as you scroll up the RecyclerView . I can achieve this very closely with the layout below, with a transparent AppBarLayout , and MyCoolView which is the header. The parallax effect works great. However, if the header is still visible and I fling the RecyclerView , the RV scrolls slowly to the top and some of the items are under the Toolbar until the RV reaches the top of the view. I've been playing around with the scrollFlags

CollapsingToolbarLayout with a ViewPager

淺唱寂寞╮ 提交于 2019-11-30 04:39:06
问题 I'm trying to use the CollapsingToolbarLayout to have a collapsible toolbar with a ViewPager that fades away while scrolling up but I seem to lose the ability to scroll up if the ViewPager is present. The ViewPager is supposed to show multiple images in the Toolbar. Here's the 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

Stop scroll on CollapsingToolbarLayout so it doesn't completely collapse

与世无争的帅哥 提交于 2019-11-30 03:17:10
I have a CollapsingToolbarLayout setup and im placing a wallpaper there. I want to be able to stop it from collapsing all the way. I have tried minheight and many other things but can't figure it out. How can i get it to stop collapsing to the second screenshot? View when activity is loaded Desired Stopping Point Current Stopping Point CollapsingToolbarLayout works really closely with Toolbar and as such the collapsed height depends on the toolbar. I was able to solve your problem using this layout ( Note it goes into the normal CoordinatorLayout / AppBarLayout Setup, With Fab and a