android-design-library

How do I change an Android Snackbar's initial alignment from bottom to top?

六眼飞鱼酱① 提交于 2019-11-29 17:11:30
问题 The recent android library came out just a few days ago, but I would like to have the SnackBar appear on top of the screen, preferably within a RelativeLayout as it's parent view. How does one change the SnackBar 's initial alignment which I presume to be layout_alignParentBottom to layout_alignParentTop ? 回答1: It is possible to make the snackbar appear on top of the screen using this: Snackbar snack = Snackbar.make(parentLayout, str, Snackbar.LENGTH_LONG); View view = snack.getView();

How to enable horizontal scroll in tab like Google Play?

浪尽此生 提交于 2019-11-29 10:39:03
问题 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

How to hide ActionBar while scrolling ListView in android?

﹥>﹥吖頭↗ 提交于 2019-11-29 09:20:07
I need to create a GUI with a ListView and an ActionBar which will hide when scrolling down and when scrolling up it must reappear. The following guides didn't help me: https://mzgreen.github.io/2015/06/23/How-to-hideshow-Toolbar-when-list-is-scrolling%28part3%29/ https://github.com/ksoichiro/Android-ObservableScrollView I need something like this: Gabriele Mariotti If you would like to obtain a list with this behaviour, you should: add the design support library with compile 'com.android.support:design:22.2.0' Use a CoordinatorLayout with a Toolbar where you have to define app:layout

Pass scroll event to another view

北城以北 提交于 2019-11-29 07:54:11
问题 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=

CollapsingToolbarLayout and TabLayout

本小妞迷上赌 提交于 2019-11-29 07:34:41
问题 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 回答1: Try this structure: <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"

ArrayIndexOutOfBoundsException while dismissing Snackbar/ViewDragHelper

▼魔方 西西 提交于 2019-11-29 06:36:02
After implementing the new Snackbar in a few of my applications, I am receiving the following error: java.lang.ArrayIndexOutOfBoundsException: length=1; index=1 at android.support.v4.widget.ViewDragHelper.shouldInterceptTouchEvent(SourceFile:1014) at android.support.design.widget.SwipeDismissBehavior.onInterceptTouchEvent(SourceFile:188) at android.support.design.widget.Snackbar$Behavior.onInterceptTouchEvent(SourceFile:659) at android.support.design.widget.Snackbar$Behavior.onInterceptTouchEvent(SourceFile:641) at android.support.design.widget.CoordinatorLayout.performIntercept(SourceFile:343

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

僤鯓⒐⒋嵵緔 提交于 2019-11-29 06:22:21
问题 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

CoordinatorLayout(AppbarLayout) does not draw toolbar properly

会有一股神秘感。 提交于 2019-11-29 06:12:13
问题 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

Android SnackBar: error inflating SnackbarLayout

拈花ヽ惹草 提交于 2019-11-29 05:35:05
I wanted to try out the new Snackbar from the official design library provided by Google. Its usage is very close to a Toast so I thought it would be simple enough to try out. I've tried it out on an emulator running 5.1 as well as Samsung Galaxy S6 Edge running 5.0. My problem is that the app crashes when it's supposed to display the Snackbar. Code package com.jayway.andreas.test; import android.app.Activity; import android.os.Bundle; import android.support.design.widget.Snackbar; import android.view.View; public class MainActivity extends Activity { @Override protected void onCreate(Bundle

How to fix the Snackbar height and position?

拈花ヽ惹草 提交于 2019-11-29 04:36:23
On Android Support Library 24.1.1 , the Snackbar was working fine: Then starting on Android Support Library 24.2.0 onwards, the Snackbar started to behave like this: On the library revision history , there is the following statement: Behavior changes: Snackbar now draws behind the navigation bar if the status bar is translucent. But the thing is that my app is full screen and it doesn't have the navigation bar or the status bar. How can I fix it? Alexandr Larin Look this answer https://stackoverflow.com/a/42180120/2550743 and just replace params.setMargins(params.leftMargin, params.topMargin,