android,android-support-library,android-design-library,android-appbarlayout
Big thanks to @m vai for the tips I solved this problem customising the behaviour of the AppBarLayout Here is the code: private void setAppBarLayoutBehaviour() { AppBarLayout.Behavior behavior = new AppBarLayout.Behavior() { @Override public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, AppBarLayout child, View directTargetChild, View target, int nestedScrollAxes) { // Trigger the following...
android,navigation-drawer,android-support-library,android-design-library,navigationview
I tried this . This worked . All you need to do is define a group with an unique ID, I have checked the implementation if group has different id's it will create a divider. See implementation from line no 122-125 This is my menu file and it is creating...
android,navigation-drawer,android-resources,android-design-library,navigationview
Confirmed, this is a bug in the support library. Apparently it's related to ContextThemeWrapper, and according to this bug report, the problem exists in Support Library 22.1 and later: So, the short answer is: Don't use XML onClick with NavigationView (or some other components like EditText), until it's fixed. Workaround:...
android,android-layout,android-design-library,snackbar
Two thoughts on what could be wrong. First, make sure you are using the correct gradle dependency: compile 'com.android.support:design:22.2.0' Second, make sure your activity is extending AppCompatActivity and not Activity or ActionBarActivity. You can read the full post for more details, but here's the relevant quote about needing AppCompat with...
android,android-design-library
I've just managed to setup new TabLayout, so here are the quick steps to do this (ノ◕ヮ◕)ノ*:・゚✧ Add dependencies inside your build.gradle file: dependencies { compile 'com.android.support:design:22.2.0' } Add TabLayout inside your layout <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.v7.widget.Toolbar...
android,toolbar,recyclerview,android-design-library
Probably you need to prevent the RecyclerView from dispatching scrolling events to its parents. private class NoScrollTouchListener implements RecyclerView.OnTouchListener{ private static final int MAX_CLICK_DURATION = 200; private long mStartClickTime; @Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: { mStartClickTime = SystemClock.currentThreadTimeMillis(); break; } case MotionEvent.ACTION_UP:...
android,android-support-library,material-design,android-design-library
If your issue is the animation, you could try invalidating the FAB Behavior. As for the visibility, you should null the anchor you have set in your layout: CoordinatorLayout.LayoutParams p = (CoordinatorLayout.LayoutParams) fab.getLayoutParams(); p.setBehavior(null); //should disable default animations p.setAnchorId(View.NO_ID); //should let you set visibility fab.setLayoutParams(p); fab.setVisibility(View.GONE); // View.INVISIBLE might also...
android,android-layout,android-design-library,android-snackbar
Solved! Firstly i removed the android-support-v4.jar from libs folder from project and then added the android-support-design library with resources[also added the support library]. After that project properties->Android->Add->Support-design library.
android,material-design,android-design-library
I believe you need to make your ListView implement both ScrollingView and NestedScrollingChild interfaces. It's not the easiest thing, but you should be able to do it if you look at RecyclerView's source code. It makes use of a NestedScrollingChildHelper and you should be able to do the same....
android,android-design-library
TextInputLayout extends ViewGroup class. So which means that you have to wrap your EditText in a TextInputLayout. <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="hint" android:id="@+id/editText1" /> </android.support.design.widget.TextInputLayout> ...
android,android-design-library
It's a bug in com.android.support:design:22.2.0. It's marked as future release, so we'll probably see a fix soon. Links with issues: https://code.google.com/p/android/issues/detail?id=175240 https://code.google.com/p/android/issues/detail?id=175069 Found here....
android,android-support-library,android-design-library,snackbar
As far as I know, it is by design. You should: Delete the item as soon as the user taps the delete button; Store it temporarily in a class variable; If the user taps Undo, add the item again to the database. This approach is safer and more robust; you...
android,listview,android-actionbar,android-design-library
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_scrollFlags="scroll|enterAlways" Use a RecyclerView instead of a ListView. As described here ListView and the GridView have the expected...
android,navigation-drawer,android-support-library,android-design-library,androiddesignsupport
You can use the standard NavigationView defining a menu like this: <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:id="@+id/group1" android:checkableBehavior="single" id> //items of group1 </group> <group android:id="@+id/group2" android:checkableBehavior="single" id> //items of group2 </group> It is important to give an unique id to each group....
android,material-design,android-design-library
As mentioned by @shkschneider, this is a known bug. Github user @ljubisa987 recently posted a Gist for a workaround: https://gist.github.com/ljubisa987/e33cd5597da07172c55d As noted in the comments, the workaround only works on Android Lollipop and older. It does not work on the Android M Preview....
android,android-design-library
After some time I finally solved it. The gradle console doesn't provide me the real cause of the problem instead it just returns those lines I've provided on the question. What I did was to run gradle dexDebug --stacktrace --info --debug then the real problem appears which is: UNEXPECTED TOP-LEVEL...
android,android-support-library,android-design-library
Why are you using a theme on the AppBarLayout? If you remove that your Toolbar will probably appear again. You can move the theme to the Toolbar: app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" Edit Add this to your ImageView: android:layout_below="@id/setting_appbar" Your ImageView was above your Toolbar so that's why you couldn't see it. One other...
android,android-design-library
Currently the only way to avoid this behavior is to add the EditText programmatically. Create a TextInputLayout without the EditText. Programmatically or via XML inflation - doesn't matter, but it has to be empty. Create the EditText and set its text to whatever you need. Add the EditTExt to the...
android,material-design,android-toolbar,android-design-library
Here's the way I managed to do this, I don't think that's the best solution though if anyone finds a better way please feel free to post the answer. <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:fitsSystemWindows="true"> <android.support.v4.view.ViewPager android:id="@+id/viewpager"...
android,android-xml,android-design-library
It is InvocationTargetException that is thrown. It implies that you version of some attributes set in your layout file is greater than your minSDKVersion. Meanwhile, according to NavigationView.inflateHeaderView(NavigationView.java:227) and Error inflating class TextView and RuntimeException: Failed to resolve attribute at index 24 there sure is something wrong in your TextView...
android,material-design,android-design-library
Is there no way for me to force NavigationView to stop tinting my icons? There sure is. You can do so programmatically using NavigationView.setItemIconTintList. And you can do so in your XML layout by using the NavigationView.itemIconTint attribute. Programmatically yourNavigationView.setItemIconTintList(null); From XML <android.support.design.widget.NavigationView ... app:itemIconTint="@android:color/black" ... /> Results ...
android,android-support-library,android-design-library
I ran the app using android studio and not IntelliJ 14 and got a different error: `Error:(1) Attribute "insetForeground" has already been defined` So if someone is running IntelliJ 14, until next update of Intellij 14 I guess It's safer to use android studio 1.3.+ (or at least check for...
android,material-design,android-design-library,android-support-design
TabLayout has a method setTabMode() which can be either MODE_FIXED (default) or MODE_SCROLLABLE which is what you need. You can also define this in XML with app:tabMode="scrollable"....
android,android-recyclerview,swiperefreshlayout,android-design-library
You can set onOffsetChanged listener for your AppBarLayout and prevent to swipe refreshing until AppBarLayout layout offset 0. This is good example : https://gist.github.com/blackcj/001a90c7775765ad5212...
android,android-design-library,androiddesignsupport
I've created a project that you can use to demonstrate this problem. I believe that this is a bug, and you can work around it by not using your own transitions. Though I also believe that not all transition animations will cause the issue. I think the hold animation in...
android,android-actionbar,material-design,android-design-library
If you don't want a CollapsingToolbar , you can use a simple Toolbar using a custom minHeight. Inside the Toolbar you can put your views, for example TextView or TextInputLayout. Finally use a FloatingActionButton. It is important to set the attributes app:layout_anchorand app:layout_anchorGravity <android.support.design.widget.CoordinatorLayout> <android.support.v7.widget.Toolbar android:id="@+id/toolbar_main" android:layout_width="match_parent" android:layout_height="256dp" android:minHeight="?attr/actionBarSize"...
android,navigation-drawer,android-support-library,android-design-library
Okay I got it working, I feel stupid after hours of back tracking of what is wrong with my code. in my xml, I use android.support.design.widget.CoordinatorLayout for the Fragment container in which I replace it back with a FrameLayout. I did that cause in the document it says that CoordinatorLayout...
java,android,android-support-library,android-design-library
In short - by making those classes non-public they're reserving the right to change/delete this class at any time without breaking any client's (your) code. Look at how many @Deprecated methods/classes there are already and you'll see why this is important....
android,fab,android-design-library
Since the new FAB is now part of the support library, you'll probably need to replace <item name="android:elevation">@dimen/fab_elevation</item> by <item name="app:elevation">@dimen/fab_elevation</item> in your style....
android,material-design,android-design-library,floating-action-button
It is due to the app:layout_anchor attribute. You must get rid of the anchor before changing visibility: CoordinatorLayout.LayoutParams p = (CoordinatorLayout.LayoutParams) fab.getLayoutParams(); p.setAnchorId(View.NO_ID); fab.setLayoutParams(p); fab.setVisibility(View.GONE); ...
android,android-layout,design,recyclerview,android-design-library
Try this: <?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:fitsSystemWindows="true"> <android.support.design.widget.AppBarLayout android:id="@+id/appbar" android:layout_width="match_parent" android:fitsSystemWindows="true"...
android,android-menu,android-design-library
The trick to call BaseAdapter.notifyDataSetChanged on the underlying Adapter that contains the menu items. You could use reflection to grab the ListView or just loop over the NavigationView children until you reach it. This isn't the most up-to-date code, as fas as I know Google hasn't pushed the most recent...
android,android-support-library,material-design,appcompat,android-design-library
You can use the support libraries to backport some features introduced with the last api (for example 21) to old devices running a previous api level. For example, API21 introduced a new widget, the Toolbar. This widget can be used only in device with API >=21. With the appcompat rel.21...
android,android-design-library,androiddesignsupport
Okay, this might looks stupid But you have to add this in dependency compile 'com.android.support:recyclerview-v7:22.2.0' ...
android,android-edittext,android-design-library
Found the answer, use android.support.design:hintTextAppearance attribute to set your own floating label appearance. Example: <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content" xmlns:app="http://schemas.android.com/apk/res-auto" app:hintTextAppearance="@style/TextAppearance.AppCompat"> <EditText android:id="@+id/password" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/prompt_password"/>...
android,android-design-library,navigationview
Found the issue in my header.xml I was using a background.png that was 1080x720p. I scaled the image down to ~400x300 and voila, interesting problem indeed.
android,navigation-drawer,android-design-library,androiddesignsupport,navigationview
1) Scrolling the navigation view scrolls the whole view but I just want the >header to stay at it's place and the navigation item to scroll. You can't obtain it with the current NavigationView. It follows the Material guidelines. If you would like this kind of pattern you have...
android,android-design-library
set tabSelectedTextColor in NavigationTab like this: <style name="NavigationTab" parent="Widget.Design.TabLayout"> <item name="tabBackground">@drawable/background_tab</item> <item name="tabSelectedTextColor">@color/primary_light</item> <item name="tabIndicatorColor">@color/blue</item> <item name="tabTextAppearance">@style/NavigationTabTextAppeareance</item> </style> <style name="NavigationTabTextAppeareance" parent="TextAppearance.Design.Tab">...
android,navigation-drawer,android-design-library,androiddesignsupport,navigationview
first create header XML like lay_header.xml <TextView android:id="@+id/tvThought" android:layout_width="wrap_content" android:layout_height="wrap_content" /> on your java file inflate this above header in a TextView. like TextView headerView = (TextView) LayoutInflater.from(this).inflate(R.layout.lay_header, null); headerView.setText("Your_thoght"); Now add it as a HeaderView navView = (NavigationView) findViewById(R.id.navView); navView.addHeaderView(headerView); Thats it......
android,material-design,android-design-library,android-snackbar
As for Snackbar,it acts like a Toast but is different with a Toast. Snackbars are shown on the bottom of the screen and contain text with an optional single action. They automatically time out after the given time length by animating off the screen. In addition, users can swipe them...
android,android-design-library,navigationview
just add following class file to your project. import android.graphics.Paint; import android.graphics.Typeface; import android.text.TextPaint; import android.text.style.TypefaceSpan; public class CustomTypefaceSpan extends TypefaceSpan { private final Typeface newType; public CustomTypefaceSpan(String family, Typeface type) { super(family); newType = type; } @Override public void updateDrawState(TextPaint ds) { applyCustomTypeFace(ds, newType); } @Override public void updateMeasureState(TextPaint...
android,recyclerview,android-design-library,coordinator-layout
Try this code. You need to use app:layout_behavior in your RecyclerView <android.support.v7.widget.RecyclerView android:id="@+id/recyclerview" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"/> <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_marginBottom="16dp" android:layout_marginEnd="16dp"...
android,android-design-library,android-coordinatorlayout
If you have a FAB with the the app:layout_anchor attribute, and you want to set the visibility you should use something like this: CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams(); params.setAnchorId(View.NO_ID); fab.setLayoutParams(params); fab.setVisibility(View.GONE); If you want to set theapp:layout_anchor dinamically you can use the same code: CoordinatorLayout.LayoutParams p = (CoordinatorLayout.LayoutParams) fab.getLayoutParams(); p.setAnchorId(xxxx);...
android,android-design-library,floating-action-button,android-support-design
To get rid of the anchor you can use: CoordinatorLayout.LayoutParams p = (CoordinatorLayout.LayoutParams) fab.getLayoutParams(); p.setAnchorId(View.NO_ID); fab.setLayoutParams(p); As far as I know, having an anchor does really, as you say, affect the possibility of hiding the button, so calling this before the visibility change should work....
android,android-support-library,android-design-library
Here it is you are looking for. from from docs the Design library introduces CoordinatorLayout, a layout which provides an additional level of control over touch events between child views, something which many of the components in the Design library take advantage of. http://android-developers.blogspot.com/2015/05/a-design-support-library.html in this link you will see...
android,android-support-library,floating-action-button,android-design-library
So in your build.gradle file, add this: compile 'com.android.support:design:22.2.0' In your themes.xml or styles.xml or whatever, make sure you set this- it's your app's accent color-- and the color of your FAB unless you override it (see below): <item name="colorAccent">@color/floating_action_button_color</item> In the layout's XML: <RelativeLayout ... xmlns:app="http://schemas.android.com/apk/res-auto"> <android.support.design.widget.FloatingActionButton android:id="@+id/myFAB" android:layout_width="wrap_content"...
android,android-support-library,android-design-library,snackbar
I found this at What is new features of Android Design Support Library and how to use its Snackbar? This worked for me for changing the text color in a Snackbar. View view = snack.getView(); TextView tv = (TextView) view.findViewById(android.support.design.R.id.snackbar_text); tv.setTextColor(Color.WHITE); ...
android,android-support-library,android-design-library,androiddesignsupport
The trick is to add android:layout_gravity="fill_vertical" to the NestedScrollView. This way the toolbar collapses and expands smoothly & reacts to scroll gestures for any non-empty NestedScrollView, no matter its size. Of course if the scroll view is empty, the toolbar won't collapse by scrolling in the "content" part of the...
android,toolbar,android-design-library
You have to set a layout behavior before. Just use following code at your onCreate method: ((CoordinatorLayout.LayoutParams) YOUR_LAYOUT.getLayoutParams()).setBehavior(new AppBarLayout.Behavior() {});...
android,android-support-library,android-design-library,android-snackbar
I have the same problem, but I'm providing an 'undo' for deleting data. This is how I deal with it: Pretend the data is deleted from db (hide from UI, which is a list of items) Wait until the snack bar 'should' have dissapeared Send the delete call to the...
android,android-design-library
Try this structure: <android.support.design.widget.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="match_parent"> <android.support.v4.view.ViewPager android:id="@+id/viewpager" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" />...
android,floating-action-button,android-design-library,appcompat-v7-r22.2
Simply setting app:borderWidth="0dp" resolve this issues for me. Note: don't forget to add xmlns:app="http://schemas.android.com/apk/res-auto" to your root layout. This issue should be fixed in next release of android design library. ...
android,android-support-library,android-design-library
You have to update your Android Support Repository in SDK Manager, then just add this dependency to your build.gradle: compile 'com.android.support:design:22.2.0' com.android.support:support-design:22.0.0 is wrong....
java,android,xml,appcompat,android-design-library
This might be dumb, but it didn't worked due to the fact that the build tool was not updated in the build.gradle of the application version to 22, I was using 21 that is why it is not working as expected to be.
android,android-design-library
Android from version to version introduces new design concepts and widgets. The objective of the Android Support Libraries is to bring the new features to the older android versions. For example, in Android 4.X the design paradigm is Holo and in the Android 5.X the design paradigm is the Material...
android,material-design,floating-action-button,android-design-library
Today (29/05/2015) it is officially avaiable with the new Material Design support Library. Just add this dependency to your build.gradle compile 'com.android.support:design:22.2.0' Add this view to your layout: <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="end|bottom" android:src="@drawable/ic_done" /> And use it: FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);...
android,material-design,drawerlayout,android-design-library,navigationview
itemBackground, itemIconTint and itemTextColor are simple xml-attributes that can be set, though you have to use a custom prefix instead of the android: one. Example <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="match_parent" android:fitsSystemWindows="true"> <!-- Other layout views -->...
android,navigation-drawer,android-design-library
Just give the unique id to each group. It will create s separator automatically. <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:id="@+id/group_feature" android:checkableBehavior="single"> <item android:id="@+id/navdrawer_item_map" android:checked="true" android:icon="@drawable/ic_drawer_map" android:title="@string/navdrawer_item_map"/> </group> <group android:id="@+id/group_settings"...
android,gradle,android-support-library,build.gradle,android-design-library
It means your project has hit the limit. Read: https://developer.android.com/tools/building/multidex.html You need to enable multidex, which you can by: defaultConfig { ... multiDexEnabled true } dependencies { ... compile 'com.android.support:multidex:1.0.0' } extend your Application class with MultiDexApplication and edit your AndroidManifest.xml as explained in the link itself....
android-tabhost,android-tabs,android-design-library
From the documentation : https://developer.android.com/reference/android/support/design/widget/TabLayout.Tab.html#setCustomView(android.view.View) Set a custom view to be used for this tab. This overrides values set by setText(CharSequence) and setIcon(Drawable). you will have to set the title values yourself From your example: public void setupTabLayout(TabLayout tabLayout) { tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); tabLayout.setTabGravity(TabLayout.GRAVITY_CENTER); tabLayout.setupWithViewPager(mViewpager); TextView tab =...
android,material-design,android-design-library
This is known by Google and will be fix soon in the next version of the Design Support Library, see this issue: FAB Appears as a square on API 16. It should only concern API 16. The workaround, proposed in the same thread, is to add app:borderWidth="0dp" to your FAB....
android,eclipse,android-support-library,floating-action-button,android-design-library
Through Eclipse's project properties dialog (Project > Properties), not only can you attach to a library project, but you can mark a project as being a library project. Normally, when you import a project, that information is pulled from the project.properties file. Alas, the Android Support Design Project does not...
android,android-5.0-lollipop,android-design-library,androiddesignsupport,material-theme
TextInputLayout relies on resources/attributes in AppCompat. You need to use an AppCompat base theme. The AppCompat themes are a parent of the Material based themes on API 21+. So, you will be using the Material theme....
android,android-support-library,material-design,android-scrollview,android-design-library
The standard ScrollView is only meant to be used as a parent. You need change the scrollview to a android.support.v4.widget.NestedScrollView. An example can be seen in the reference documentation for AppBarLayout....
android,android-support-library,android-design-library
You might have ScrimInsetsFrameLayout for your Navigation drawer design in your project. Remove those attribute resources in your attr and replace the drawer layout with NavigationView.
android-studio,material-design,android-design-library
Dont follow the above tutorial, the shown approach is useful when the library has not published as maven or gradle dependency.But as Github page say it is published on maven. So remove the module or library project completely from your project and use gradle dependency instead. Just copy this in...
android,xml,material-design,android-design-library,collapsingtoolbarlayout
Question 1 Add android:fitsSystemWindows="true" to your AppBarLayout, CollapsingToolbarLayout, and to your ImageView. I'm guessing a part of your image is below the status bar (due to these lines being missing) which is why you can't see the top of the image. Question 2 collapseMode="pin" only affects how the Toolbar reacts...
android,android-library,floating-action-button,android-design-library
No, it is not included (yet) on the official support library. You have to use a 3rd party library for FloatingActionButtons There are many, this one is the most popular: https://github.com/makovkastar/FloatingActionButton...
android,android-layout,android-design-library
I had this problem and fixed adding: android:layout_gravity="fill_vertical" to the NestedScrollView. Then it starts behaving correctly, as I explained here also. Of course the NestedScrollView needs some kind of child (i.e. it must not be empty), otherwise the toolbar won't collapse. Update While this works well with small content, I...
android,appcompat,android-design-library,appcompat-v7-r22.2
Okie, I fixed it! What I was doing was, I want to display ToolBar content in white color as my ToolBar is dark so I used this line <item name="theme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item> in styles.xml This was working fine with appcompat-v7:21.+. But in appcompat-v7:22.2.0 as the app:theme was depreciated (mentioned by @Guillaume Imbert...
java,android,eclipse,material-design,android-design-library
You should try to use Android Studio, because the ADT plugin for Eclipse is no longer in active development. In Android Studio, you just need to add a line compile 'com.nispok:snackbar:2.6.1' in your build.gradle dependencies, such that dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:21.0.2' compile 'com.nispok:snackbar:2.6.1' } That's...
android,colors,android-design-library,androiddesignsupport,android-snackbar
Instead of this: .setActionTextColor(R.color.yellow) try: .setActionTextColor(Color.YELLOW) ...
android,android-design-library,androiddesignsupport
You can do it easily ... tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Override public void onTabSelected(TabLayout.Tab tab) { pos = tab.getPosition(); } @Override public void onTabUnselected(TabLayout.Tab tab) { } @Override public void onTabReselected(TabLayout.Tab tab) { } }); ...
android,android-layout,android-design-library,android-coordinatorlayout,coordinator-layout
You should use a FAB in activity layout. .If you need different colors or actions you can define FAB in your fragment and set the color or the action for each fragment.
android,android-design-library,androiddesignsupport,collapsingtoolbarlayout
Change to some certain height in the AppbarLayout. Example: android:layout_height="300dp". The main problem being, the nested scroll view does not have enough views to cause a scroll. Hence the parallax effect would not work. Here is a working example that uses NestedScrollView and CollapsingToolbarLayout...
android,android-fragments,android-design-library,android-tablayout
If you want the dialog to be full screen, the root view should be a FrameLayout (instead of a LinearLayout). If you want the dialog to contain a Toolbar, you'll also need a second Toolbar since your first one is attached to the TabLayout. Something like this should work: activity_main.xml...
android,android-support-library,android-design-library,navigationview
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. ...
android,android-support-library,android-design-library
In addition to Emmanuel's answer you could be facing the following problem. It seems like the design library components need a style which is based on an AppCompat Theme. So try to use "Theme.AppCompat.[...]" as a parent in your style.xml. Example: <!-- Base application theme. --> <style name="AppTheme" parent="Base.AppTheme"> <!--...
android,android-design-library,android-coordinatorlayout
This can also be observed in the cheesesquare demo when removing all but one card in the details fragment. I was able to solve this (for now) using this class: https://gist.github.com/EmmanuelVinas/c598292f43713c75d18e <android.support.v4.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="com.evs.demo.layout.FixedScrollingViewBehavior"> ..... </android.support.v4.widget.NestedScrollView> ...
android,xml,material-design,android-design-library,collapsingtoolbarlayout
You need to add app:layout_behavior="@string/appbar_scrolling_view_behavior" to your NestedScrollView - this marks the class which should be positioned below the AppBarLayout (and hence, below the CollapsingToolbarLayout).
android,android-design-library
It looks like I need to set tabGravity to center and tabMode to scrollable. <android.support.design.widget.TabLayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/colorPrimary" app:tabGravity="center" app:tabMode="scrollable" /> ...
android,android-layout,android-design-library,androiddesignsupport
I found the blue strip was the toolbar background. Namely, I had: <item name="toolbarStyle">@style/MyToolbarStyle</item> in my theme, and: <style name="MyToolbarStyle"> <item name="android:background">?attr/colorPrimary</item> </style> I used to have this to tint toolbars with colorPrimary. However if you want to move to the design library, you should get rid of it: the...
android,material-design,android-design-library,snackbar,android-snackbar
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(); FrameLayout.LayoutParams params = (FrameLayout.LayoutParams)view.getLayoutParams(); params.gravity = Gravity.TOP; view.setLayoutParams(params); snack.show() Note: The animation from the snackbar begins from the bottom and surges up to the top...
java,android,xml,appcompat,android-design-library
Make sure you're using com.android.support:recyclerview-v7:22.2.0 (With version prior to 22.2.0 it didn't work for me either)...