android-design-library

FAB - square on pre Lollipop and without shadow on Lollipop

情到浓时终转凉″ 提交于 2019-11-27 20:31:53
It looks like FloatingActionButton is not working ether on Android 4.0 and Lollipop. As you can see on image below, on Android Lollipopo shadow is missing and on Android 4.1.1 it's square :/ Anyone faced this issue? Library version: compile 'com.android.support:design:22.2.0' Code: <android.support.design.widget.FloatingActionButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/abc_ic_clear_mtrl_alpha"/> Thanks to @harism comment, simply setting app:borderWidth="0dp" resolve both issues. Note: don't forget to add xmlns:app="http://schemas

CollapsingToolbar not working with not-so-tall content

落花浮王杯 提交于 2019-11-27 20:23:28
问题 I'm pretty sure this is a bug, so I'm asking for a workaround. My layout is like: <CoordinatorLayout> <AppBarLayout> <CollapsingToolbarLayout> <ImageView/> <Toolbar/> </CollapsingToolbarLayout> </AppBarLayout> <android.support.v4.widget.NestedScrollView/> <!-- content here --> </CoordinatorLayout> I'm retrieving content from the web, and I don't know how tall it'll be - might be few lines, might be very long. However, I discovered that CollapsingToolbar doesn't work well when content is not

Design support library - Which version to use with SDK v21

不羁岁月 提交于 2019-11-27 20:08:28
I have problems to understand the version scheme of the support libraries and when to use which version. Currently I have a project with compileSdkVersion 21 , minSdkVersion 21 and targetSdkVersion 21 and want to use the android design support library. When I use com.android.support:design:22.2.0 the project compiles but I get a Gradle warning: "This support library should not use a different version (22) than the `compileSdkVersion` (21)". When I use com.android.support:design:23.0.1 I get some compilation errors like: "Error:(2) Error retrieving parent for item: No resource found that

FloatingActionButton doesn't hide

人盡茶涼 提交于 2019-11-27 18:58:28
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 reappears when I scroll. Here is my 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/main_content" android:layout_width="match_parent" android:layout_height="match_parent" android

How can i determine that CollapsingToolbar is collapsed?

狂风中的少年 提交于 2019-11-27 18:44:22
I need to know when CollapsingToolbar from material design library is collapsed. Marko UPDATE : Since support versions of 23.1.1+ the issue is no longer there, no need to use the listener and disable the swipe refresh layout, it will work as it should ( link ). Implement AppBarLayout.OnOffsetChangedListener listener on your AppBarLayout AppBarLayout appBarLayout = (AppBarLayout) view.findViewById(R.id.app_bar_layout); appBarLayout.addOnOffsetChangedListener(this); And check if offset is 0, meaning the toolbar is fully expanded. @Override public void onOffsetChanged(AppBarLayout appBarLayout,

TabLayout (Android Design Library) Text Color

房东的猫 提交于 2019-11-27 18:38:56
I'm using the new TabLayout from the Android Design library. I managed to set the textcolor statelist using tabLayout.setTabTextColors(colorstatelist) How can i achieve the same using styles.xml? Via XML attributes: <android.support.design.widget.TabLayout android:layout_width="match_parent" android:layout_height="wrap_content" app:tabMode="fixed" app:tabGravity="fill" app:tabTextColor="@color/your_unselected_text_color" app:tabSelectedTextColor="@color/your_selected_text_color"/> Additionally, there are attributes like tabIndicatorColor or tabIndicatorHeight for further styling. In code:

Android Multiline Snackbar

泪湿孤枕 提交于 2019-11-27 18:26:34
I'm trying to leverage new Snackbar from Android Design Support Library to display multiline snackbar, as shown in http://www.google.com/design/spec/components/snackbars-toasts.html#snackbars-toasts-specs : import android.support.design.widget.Snackbar; final String snack = "First line\nSecond line\nThird line"; Snackbar.make(mView, snack, Snackbar.LENGTH_LONG).show(); It displays only First line... on my Nexus 7. How to make it display all lines? PS: I tried Toast and it displayed all lines. Nilesh Senta Just set the maxLines attribute of Snackbars Textview View snackbarView = snackbar

TabLayout Tab Title text in Lower Case

血红的双手。 提交于 2019-11-27 18:16:50
I have used android.support.design.widget.TabLayout in my application with Min SDK 15. By default it takes Tab title in capitals but I want it to make in "textCapsWord". I tried adding Style as suggested here and here . But unfortunate both doesn't work. Mustanser Iqbal If you add the following line to your TabLayout it should work: app:tabTextAppearance="@android:style/TextAppearance.Widget.TabWidget" Use it like this: <android.support.design.widget.TabLayout android:id="@+id/tabLayout" android:layout_width="match_parent" android:layout_height="wrap_content" app:tabIndicatorColor="@android

Android NavigationView menu group divider [duplicate]

烂漫一生 提交于 2019-11-27 18:04:43
This question already has an answer here: How to create a simple divider in the new NavigationView? 13 answers Android support design library provide NavigationView: <android.support.design.widget.NavigationView ... app:menu="@menu/navigation_drawer_items" /> menu/navigation_drawer_items: <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:checkableBehavior="single"> <item .../> ... </group> <group android:checkableBehavior="single"> <item .../> ... </group> </menu> How to add divider, separator or space between groups (like on picture)? Moinkhan Just give a unique

How can I be notified when a Snackbar has dismissed itself?

梦想与她 提交于 2019-11-27 17:56:42
I'm using a Snackbar from the com.android.support:design:22.2.0 library. I'm using it to undo deletions. To make my life easier, I'm going to make the UI look like things are actually deleted from the data source, and if the undo button in the snack bar is not pressed, actually perform the deletions from the data source. So, I want to know when the Snackbar is no longer visible, so it's safe to delete the items. I can call getView() on the Snackbar, but I'm not sure what listener I should be using. I tried setOnSystemUiVisibilityChangeListener() but that didn't work, I believe it is only for