How to add footer to NavigationView – Android support design library?

If you want a fixed (non-scrolling) footer in your navigation menu, you need wrap NavigationView around another layout, like you’ve posted. NavigationView works like FrameLayout, so this ends up “stacking” the inner layout on top of the NavigationView menu items. Here’s one way to arrange it, using LinearLayout for the footer items: Fixed Footer <android.support.design.widget.NavigationView … Read more

how to change color of TextinputLayout’s label and edittext underline android

Change bottom line color: From this answer <item name=”colorControlNormal”>#c5c5c5</item> <item name=”colorControlActivated”>@color/accent</item> <item name=”colorControlHighlight”>@color/accent</item> Change hint color when it is floating <style name=”MyHintStyle” parent=”@android:style/TextAppearance”> <item name=”android:textColor”>@color/main_color</item> </style> and use it like this: <android.support.design.widget.TextInputLayout … app:hintTextAppearance=”@style/MyHintStyle”> Change hint color when it is not a floating label: <android.support.design.widget.TextInputLayout … app:hintTextAppearance=”@style/MyHintStyle” android:textColorHint=”#c1c2c4″> Thanks to @AlbAtNf

How to create a simple divider in the new NavigationView?

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. Example menu, creating the separator: <menu 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” tools:context=”.MainActivity”> <group android:id=”@+id/grp1″ android:checkableBehavior=”single” > <item android:id=”@+id/navigation_item_1″ android:checked=”true” android:icon=”@drawable/ic_home” android:title=”@string/navigation_item_1″ /> </group> <group android:id=”@+id/grp2″ android:checkableBehavior=”single” > <item android:id=”@+id/navigation_item_2″ … Read more

Flinging with RecyclerView + AppBarLayout

The answer of Kirill Boyarshinov was almost correct. The main problem is that the RecyclerView sometimes is giving incorrect fling direction, so if you add the following code to his answer it works correctly: public final class FlingBehavior extends AppBarLayout.Behavior { private static final int TOP_CHILD_FLING_THRESHOLD = 3; private boolean isPositive; public FlingBehavior() { } … Read more

Change EditText hint color when using TextInputLayout

Define android:textColorHint in your application theme: <style name=”AppTheme” parent=”Theme.AppCompat.NoActionBar”> <item name=”colorPrimary”>@color/primary</item> <item name=”colorPrimaryDark”>@color/primary_dark</item> <item name=”colorAccent”>@color/accent</item> <item name=”android:textColorHint”>@color/secondary_text</item> </style> Source Or, in your layout, like: <android.support.design.widget.TextInputLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android.support.design:hintTextAppearance=”@style/GreenTextInputLayout” android:textColorHint=”@color/secondary_text”>

NavigationView get/find header layout

Version 23.1.0 switches NavigationView to using a RecyclerView (rather than the previous ListView) and the header is added as one of those elements. This means it is not instantly available to call findViewById() – a layout pass is needed before it is attached to the NavigationView. For version 23.1.1 of the Support Library, you can … Read more

How to change the floating label color of TextInputLayout

Try The Below Code It Works In Normal State <android.support.design.widget.TextInputLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:theme=”@style/TextLabel”> <android.support.v7.widget.AppCompatEditText android:layout_width=”match_parent” android:layout_height=”wrap_content” android:hint=”Hiiiii” android:id=”@+id/edit_id”/> </android.support.design.widget.TextInputLayout> In Styles Folder TextLabel Code <style name=”TextLabel” parent=”TextAppearance.AppCompat”> <!– Hint color and label color in FALSE state –> <item name=”android:textColorHint”>@color/Color Name</item> <item name=”android:textSize”>20sp</item> <!– Label color in TRUE state and bar color FALSE and TRUE State … Read more

TabLayout tab selection

If you know the index of the tab you want to select, you can do it like so: TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); TabLayout.Tab tab = tabLayout.getTabAt(someIndex); tab.select(); This technique works even if you’re using the TabLayout by itself without a ViewPager (which is atypical, and probably bad practice, but I’ve seen it done).