android-design-library

Overlap scrolling view with AppBarLayout

百般思念 提交于 2019-11-26 23:15:27
I want to implement the 'Flexible Space with overlapping content' pattern from the Material design scrolling techniques , such as in this video : My XML layout right now looks like: <android.support.design.widget.CoordinatorLayout android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="192dp" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> <android.support.design.widget.CollapsingToolbarLayout android:layout_width="match_parent" android:layout_height="match

FloatingActionButton doesn't hide

一曲冷凌霜 提交于 2019-11-26 22:44:52
问题 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

How can i determine that CollapsingToolbar is collapsed?

ぐ巨炮叔叔 提交于 2019-11-26 22:41:26
问题 I need to know when CollapsingToolbar from material design library is collapsed. 回答1: 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,

Don't collapse Toolbar when RecyclerView fits the screen

眉间皱痕 提交于 2019-11-26 22:33:43
问题 I've made an app using Android Design Library , with a Toolbar and TabLayout. Actually 2 tabs are present, both with 2 RecyclerView, that automatically collapse the Toolbar when scrolled. My question is: can I disable Toolbar collapsing when RecyclerView has few items and completely fits the screen (like in TAB 2)? I've seen a lot of examples like CheeseSquare, made by a Google employee where the issue is still present: even if the RecyclerView has just 1 item, the toolbar keeps hiding on

How I can remove the unnecessary top padding of the Navigation view?

一曲冷凌霜 提交于 2019-11-26 22:29:11
There's an unnecessary top padding between the header and the first item shown in this picture. How it can be removed? you can find the source code here: https://github.com/chrisbanes/cheesesquare ianhanniballake NavigationView seeks to match the material design specs for the navigation drawer which state an 8dp space between content areas. Generally there are no ways to override NavigationView to specifically break the specifications. You can override predefined dimensions at your dimens.xml as; <dimen name="design_navigation_padding_top_default" tools:override="true">0dp</dimen> <dimen name=

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

不问归期 提交于 2019-11-26 22:19:33
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 21+? <android.support.design.widget.FloatingActionButton android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/ic_add" android:clickable="true" /> Note: Adding android:elevation does not add shadow on API 21. Screenshot taken from the example by dandar3: https://github.com/dandar3/android-support-design Simply setting app:borderWidth="0dp" resolve this issues

Android design library CoordinatorLayout, AppBarLayout and DrawerLayout

最后都变了- 提交于 2019-11-26 21:13:16
问题 I'm using the Android design library on API 22. I would like to: have a Toolbar and a DrawerLayout inside which there is a RecyclerView have the DrawerLayout be below the Toolbar; for example, when the toolbar is visible, the drawer's main content should be below it, and the (left) drawer should also be below it so that when it is expanded, the toolbar is still visible have Toolbar be scrolled off the screen when the recycler view is scrolled down Is this even possible? I have problems to

FAB - square on pre Lollipop and without shadow on Lollipop

▼魔方 西西 提交于 2019-11-26 20:25:56
问题 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"/> 回答1: Thanks to @harism comment, simply

Changing the background color of a Tab in TabLayout (Android design support library) doesn't occupy the entire tab space

青春壹個敷衍的年華 提交于 2019-11-26 20:03:58
I have a TabLayout (design support library) which is tied up to a ViewPager containing three tabs. I have designed a custom layout and set that to each tab in the TabLayout. I have been trying to change the background color of the currently selected tab. The color only wraps up around the text in the tab but doesn't occupy the entire tab space. Below are the code snippets of my activity and the custom layout file. Activity code public class CustomTabLayoutActivity extends AppCompatActivity { private TabLayout tabLayout; @Override protected void onCreate(Bundle savedInstanceState) { super

Change the font of tab text in android design support TabLayout

喜欢而已 提交于 2019-11-26 19:47:58
I'm trying to work on the new TabLayout from the android design library. I want to change tab text to custom font . And,I tried to search some styling related to TabLayout ,but ended up to this . Please guide how can I change the tab text fonts. Farmaan Elahi Create a TextView from Java Code or XML like this <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@android:id/text1" android:layout_width="match_parent" android:textSize="15sp" android:textColor="@color/tabs_default