android-design-library

params.getBehaviour() returns null value

人走茶凉 提交于 2019-12-05 13:47:24
I was playing with the new Android Design Library. The CollapsingToolbarLayout works perfectly. However, I am having trouble setting default state of toolbar as Collapsed. I am trying to implement the solution shown here and here I am calling following code in my onResume of Activity: CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) appBarLayout.getLayoutParams(); AppBarLayout.Behavior behavior = (AppBarLayout.Behavior) params.getBehavior(); if(behavior!=null) { Log.d("DEBUG", "Behaviour is Not Null "); int[] consumed = new int[2]; behavior.onNestedPreScroll(coordinator

What is the navigation drawer icons size?

删除回忆录丶 提交于 2019-12-05 13:20:36
问题 I need to know the correct size (artboard and content) for Navigation Drawer icons. It doesn't say anything on the Navigation Drawer specs: http://www.google.com.br/design/spec/patterns/navigation-drawer.html#navigation-drawer-specs Thanks! 回答1: I would vote up Balar's answer, but it is off by one small detail. The correct answer is that all small icons should be 24 x 24 dp . Reference: https://material.io/guidelines/layout/metrics-keylines.html#metrics-keylines-touch-target-size 回答2: For:

Gradle error after add android support design library

不打扰是莪最后的温柔 提交于 2019-12-05 11:24:54
I'm getting this error after add compile 'com.android.support:design:22.2.0' to my gradle file: .../app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.0/res/values/values.xml with this message Error:(1) Attribute "insetForeground" has already been defined . I have this on my build.gradle file: ` compile 'com.android.support:design:22.2.0' compile 'com.android.support:cardview-v7:22.2.0' compile 'com.android.support:recyclerview-v7:22.2.0' compile 'com.google.android.gms:play-services-base:7.5.0' compile 'com.google.android.gms:play-services-location:7.5.0' compile 'com

Is there an alternative to NestedScrollView for use with a WebView?

我的梦境 提交于 2019-12-05 09:41:48
When using a WebView inside a NestedScrollView there are a few issues. The main one I'm fighting is that sites which load more content as you scroll down don't work well, for example vimeo.com. Also setting the view to LAYER_TYPE_HARDWARE doesn't work, probably for the same reason, it basically crashes because of the height. So, is there an alternative to the NestedScrollView if I want to use CoordinatorLayout in order to collapse the toolbar when the user scrolls inside the WebView ? My code is below. In order to reproduce the issue just load vimeo.com and scroll to the bottom. activity

remove or hide header navigationView in android

拟墨画扇 提交于 2019-12-05 08:32:44
i am using design 23.1.1 in my project. i want drawer without header. just menu items are enough. i dont add any header view(programmatically or in XML). but in drawer i have empty header. please help me how to remove this empty header. <android.support.design.widget.NavigationView android:id="@+id/navigation_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="right" app:menu="@menu/drawer" /> View headerView= LayoutInflater.from(this).inflate(R.layout.drawer_header, null); navigationView.addHeaderView(headerView); navigationView.getHeaderView

Snackbar action text color not changing

青春壹個敷衍的年華 提交于 2019-12-05 08:28:10
问题 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", Snackbar.LENGTH_LONG).setActionTextColor(R.color.yellow).setAction("OK", new View.OnClickListener() { @Override public void onClick(View view) { } }).show(); 回答1: The argument of setActionTextColor is the int that represents the color, not the resource ID. Instead of this: .setActionTextColor(R.color

Single fling to uncollapse Android's CollapsingToolbarLayout

偶尔善良 提交于 2019-12-05 05:59:04
I have implemented a CollapsingToolbarLayout with a parallax view. When I scroll back up the RecyclerView in one continuous scroll it uncollapses the CollapsingToolbarLayout . But when I issue a 'fling' the nested scroll view, it stops at the top of the nested scroll view. You have to fling again to uncollapse the CollapsingToolbarLayout , The ScrollingActivity template in Android Studio 2.0 demonstrates this problem. And Chris Bain's Cheesecake project , in the detail view, demonstrates the same. However, neither Google Play nor Spotify exhibit this problem in the 'view app' and 'playlist'

AppBarLayout child doesn't collapse when scrolling

两盒软妹~` 提交于 2019-12-05 04:59:30
问题 I have a AppBarLayout which contains an horizontal RecyclerView among its children. The sibling of the AppBarLayout is a ViewPager (which contains a vertical RecyclerView ). Here is the XML: <android.support.design.widget.CoordinatorLayout android:id="@+id/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:layout_width="match_parent" android:layout_height=

My FloatingActionButton has some weird lines coming out of it on 4.4 and lower

心不动则不痛 提交于 2019-12-05 03:40:50
As the title says, my FloatingActionButton has some weird lines coming out of it only on 4.4 or lower. On Lollipop it works fine. This is a picture of the issue: The play image doesn't have those lines in it. My xml: <android.support.design.widget.FloatingActionButton android:id="@+id/play" android:layout_width="48dp" android:layout_height="48dp" android:src="@drawable/ic_av_play_arrow" app:borderWidth="0dp" app:elevation="6dp" app:layout_anchor="@+id/image" app:layout_anchorGravity="center_vertical|right|end" app:rippleColor="@color/color_primary_light" /> So what am I doing wrong? EDIT: goes

Styling text on TabLayout

强颜欢笑 提交于 2019-12-05 01:57:21
I'm trying to style the new TabLayout from android design library. <style name="NavigationTab" parent="Widget.Design.TabLayout"> <item name="tabBackground">@drawable/background_tab</item> <item name="tabIndicatorColor">@color/blue</item> <item name="tabTextAppearance">@style/NavigationTabTextAppeareance</item> </style> And the text is defined right here <style name="NavigationTabTextAppeareance" parent="TextAppearance.Design.Tab"> <item name="android:textColor">@color/primary_light</item> <item name="android:textSize">12sp</item> </style> But the selected tab is always black, how can I change