FAQ Database Discussion Community


Customising NavigationView - Adding dynamic headerView, Android Support Design Library

android,navigation-drawer,android-design-library,androiddesignsupport,navigationview
I tried the navigationView from the new android support design library. I want to have a dynamic headerview. Basically, my headerview will show something like quote of the day. I have like around 10 quotes and i want to randomly select a quote and display in a textview in the...

How to get the current selected item position using TabLayout in Android Design Library

android,android-design-library,androiddesignsupport
I am using the android design library TabLayout in that how can I get the current selected item tab position. ViewPager pager = (ViewPager) view.findViewById(R.id.pager); MyPagerAdapter adapter = new MyPagerAdapter(getChildFragmentManager()); pager.setAdapter(adapter); tabLayout.setupWithViewPager(pager); ...

CollapsingToolbarLayout not working(collapsing)when scrolled

android,material-design,android-toolbar,androiddesignsupport,collapsingtoolbarlayout
I am trying to create a CollapsingToolbarLayout and below it a listview, when the listview is scrolled the Toolbar should collapse, but its not working when scrolled the Toolbar is not collapsing. Used this tutorial: http://android-developers.blogspot.in/2015_05_01_archive.html Note: The FrameLayout contains the listview <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content"...

Error in gradle: Design Navigation Library include

android,android-gradle,navigation-drawer,androiddesignsupport
I have trying to use the Design Navigation Library from Android so I have to modify my gradle adding ... compile 'com.android.support:design:22.2.0' compile 'com.android.support:support-v4:22.2.0' I have added them and this is my actual gradle: apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { applicationId "demo31.navigation" minSdkVersion 15 targetSdkVersion...

Floating Action Button not showing fully inside a fragment

android,android-fragments,floating-action-button,androiddesignsupport,android-coordinatorlayout
I am using FAB button along with RecyclerView in a Fragment. This Fragment is an instance of a TabViewPager. I am having a issue with the FAB button. I have placed the RecyclerView and the fab button inside a FrameLayout, where the FAB buttton is positioned bottom right. Now the...

Android Design Support Library Secondary Drawer Menu

android,navigation-drawer,android-support-library,android-design-library,androiddesignsupport
I've switched to the official Google Design Support Library. Now, I want to use a secondary menu with a divider like this: But as Android is using the Menu Inflater I have no idea what to do now. I can add a second group, but then the items have the...

Android Design Support TabLayout overlapping content

android,layout,tabs,android-toolbar,androiddesignsupport
I am using the new TabLayout introduced in the design support library. I have the code like this: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="match_parent" android:layout_width="match_parent"> <android.support.design.widget.CoordinatorLayout android:id="@+id/lines_coordinator" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent"...

Android design support navigation drawer huge actionbar

android,android-actionbar,navigation-drawer,androiddesignsupport
I am implementing the design support navigation drawer and I got it working, but the problem is the toolbar is now huge, it extends over the entire activity height. The code I am using: activity_main: <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_height="match_parent" android:layout_width="match_parent" android:fitsSystemWindows="true"> <include android:id="@+id/toolbar"...

Android : Using NavigationView as a BaseActivity

android,androiddesignsupport,navigationview
I'm working on design support library and I would like to have "Same Navigation Drawer in different Activities". I tried extending MainActivity with following code, but doesn't work. MainActivity.java public class MainActivity extends AppCompatActivity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mDrawer = (NavigationView) findViewById(R.id.main_drawer); mDrawer.setNavigationItemSelectedListener(this); mDrawerLayout = (DrawerLayout)...

NavigationView menu items with counter on the right

android,navigation-drawer,material-design,androiddesignsupport,navigationview
The new NavigationView in the new Design Support Library works really great. They uses "menu-items" to display the options. But how can I achieve to display a count to the right of the menu item? Like in this picture: Or like in the GMail app....

Android design support library with Theme.Material

android,android-5.0-lollipop,android-design-library,androiddesignsupport,material-theme
I would like to use the new design support library in my application beginning with the API 21. I want to use Theme.Material style but it's work only with Theme.AppCompat style. When I use Theme.Material, android return this error: error inflating class android.support.design.widget.textinputlayout" How can I resolve it ? Thank...

(Design Support Library) CollapsingToolbarLayout — Toolbar not getting pinned on collapse

android,android-support-library,android-toolbar,androiddesignsupport,collapsingtoolbarlayout
I'm having trouble integrating the Design Support Library into my application. For some reason, the toolbar collapses with the CollapsingToolbarLayout, and does not leave it pinned like in the Cheesesquare example by Chris Banes. https://github.com/chrisbanes/cheesesquare I didn't do anything different to my layout. In fact, I replaced my styles with...

AppBarLayout is not responding to scroll in the fragment

android,android-design-library,androiddesignsupport
I am using the new Android Support Design library. I have followed the demo on the Android Developer Blogspot except I use a fragment for RecyclerView instead of putting both in the same xml. Here's my activity_main.xml <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/drawer_layout" >...

Android switch Fragments in the new design support navigation drawer

android,android-fragments,navigation-drawer,androiddesignsupport
how can I switch Fragments in the new design support navigation drawer? I found example codes on the Cheesesquare Github on how to switch fragments using the TabLayout, but not the navigation drawer. Is that the same? I also would not like to recreate fragments when switching, but rather do...

Android design library FAB no shadow

android,android-actionbar,android-toolbar,floating-action-button,androiddesignsupport
for some reason my FAB displays no shadow, even though I have set the elevation and the border width to 0, like it was described in many blogs. That should fix the issue. I am placing the fab above the toolbar to get the material design guideline look. Here is...

CollapsingToolbar not working with not-so-tall content

android,android-support-library,android-design-library,androiddesignsupport
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...

Change Navigation View Item Color Dynamicly Android

android,drawerlayout,androiddesignsupport,navigationview
I'd like to build a navigation drawer where each item has a different selection color (the icon tint and text color) as the google play store has: I'm not sure how they've solved this, I think they use different activities with different drawers. I want to use fragments and I...

ImageView in CollapsingToolbarLayout not covering full height?

android,android-layout,android-design-library,androiddesignsupport
I have some issues trying to implement the new CollapsingToolbarLayout. Scrolling, expanding and collapsing do work fine, but my ImageView (no matter what type of resource I set) does not cover the full height of the expanded toolbar. See here: Here I set android:src="@color/red" on the image view, but it...

NavigationView throwing error: No resource identifier found for attribute 'menu' in package

android,material-design,drawerlayout,androiddesignsupport,navigationview
I am trying to add NavigationView in my layout as below: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin">...