Questions tagged [android-design-library]

The Design package provides APIs to support adding material design components and patterns to your apps.

The Design Support library adds support for various material design components and patterns for app developers to build upon, such as navigation drawers, floating action buttons (FAB), snackbars, and tabs.

744 questions
61
votes
8 answers

How to use setDuration() method in SnackBar (Android Design Support Library)

From Documentation: parameter duration - either be one of the predefined lengths: LENGTH_SHORT, LENGTH_LONG, or a custom duration in milliseconds. But I can't set custom duration. For example Snackbar .make(parentLayout, "Feed cat?", 8000) //…
tehnolog
  • 1,204
  • 1
  • 11
  • 23
59
votes
4 answers

Snackbar is not working within fragment class

I am trying to show snackbar view when I click on button but it shows force close error when I click on button I have define fragment class below and also error log. I have fragment class: public class HomeFragment extends Fragment { …
57
votes
6 answers

How to add shadow to the FAB provided with the android support design library?

The title is pretty self explaining. The following code does not render shadow below the Floating Action Button. What can be done to render shadow? Is this feature really not supported even on API…
55
votes
9 answers

How to reset the Toolbar position controlled by the CoordinatorLayout?

The app I'm working on consists of a Navigation Drawer which is implemented in an Activity. The activity layout is as follows:
53
votes
6 answers

CoordinatorLayout using the ViewPager's RecyclerView

I am using the view CoordinatorLayout from android.support.design. I want to attach the app:layout_behavior to the fragment's RecyclerView? In the example given by Google, they only attach it in the RecyclerView of the same XML file where the…
52
votes
2 answers

When using the CoordinatorLayout my ScrollView has an incorrect size

I'm using a ScrollView in a layout, and am attempting to use the new CoordinatorLayout from the design support library. My layout file looks like this:
50
votes
9 answers

Using Google Design Library how to hide FAB button on Scroll down?

Google have released Design library, I am using compile 'com.android.support:design:22.2.1' However I cant see any code examples of how to use this library and how to animate the FAB bar on scroll. I guess I can listen for scroll events on the…
50
votes
17 answers

FloatingActionButton doesn't hide

I am trying to hide my FloatingActionButton fabLocation programmatically with : fabLocation.setVisibility(View.GONE) but it does not work. If I add android:visibility="gone" in my XML layout, fabLocation is hidden when I run my activity but it…
49
votes
12 answers

Set initially selected item index/id in BottomNavigationView

I have implemented BottomNavigationView and have no idea how to set selection index or MenuItem id (in my case, middle item should be selected by default). I'm afraid there's no such possibility for now as far as it's too raw yet, but anyways any…
49
votes
4 answers

How to enable horizontal scroll in tab like Google Play?

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…
49
votes
4 answers

Android L - Floating Action Button (FAB)

Did Google already released a defined style or a component for this new circular FAB button or should I implement the design on my own? The button is described here: Google Design | Floating Action Buttons EDIT (05/2015): Check Lukas' answer /…
47
votes
2 answers

CoordinatorLayout with RecyclerView & CollapsingToolbarLayout

I've been attempting to implement a CollapsingToolbar with a RecyclerView using the small amount of guidance here: http://android-developers.blogspot.co.uk/2015/05/android-design-support-library.html and the project here:…
Kieron
  • 1,982
  • 2
  • 18
  • 17
46
votes
5 answers

How can I determine that CollapsingToolbar is collapsed?

I need to know when CollapsingToolbar from material design library is collapsed.
46
votes
5 answers

Snackbar action text color not changing

I want to change the action text color for my snackbar, but it is not working for some reason. I use the following code to display a snackbar: Snackbar.make(findViewById(R.id.root), "text",…
1 2
3
49 50