How to get Adview below Viewpager in CoordinatorLayout

You can add ViewPager and AdView inside RelativeLayout and specify android:layout_above=”@+id/adView” property to ViewPager so that adView doesn’t block the ViewPager contents. <RelativeLayout 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” xmlns:ads=”http://schemas.android.com/apk/res-auto” android:layout_width=”match_parent” android:layout_height=”match_parent” tools:context=”com.candyx.testapp.Activity”> <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:layout_above=”@+id/adView”> <android.support.design.widget.AppBarLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:background=”@drawable/main_button_background”> <android.support.v7.widget.Toolbar xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/toolbar” android:layout_width=”match_parent” android:layout_height=”?attr/actionBarSize” app:layout_scrollFlags=”scroll|enterAlways”/> <android.support.design.widget.TabLayout android:id=”@+id/tabs” android:layout_width=”match_parent” android:layout_height=”wrap_content” app:tabMode=”scrollable” app:tabGravity=”fill” app:tabIndicatorColor=”@color/colorTabIndicator” app:tabIndicatorHeight=”3dp”/> … Read more

CoordinatorLayout inside another CoordinatorLayout

I know it’s an old question. But I searched a long time to include an CoordinatorLayout in a fragment, which is in another CoordinatorLayout. I modified the answer of dev.bmax a little bit to call both coordinator layouts and call the attached behaviors of both layouts. So here is my solution. @SuppressWarnings(“unused”) public class NestedCoordinatorLayout … Read more

ListView not expanding inside NestedScrollView

you can fix it when you add addtribute android:fillViewport=”true” in android.support.v4.widget.NestedScrollView 🙂 . This my code. <android.support.v4.widget.NestedScrollView android:layout_width=”match_parent” android:layout_height=”match_parent” android:scrollbars=”none” app:layout_behavior=”@string/appbar_scrolling_view_behavior” android:fillViewport=”true” > <ListView android:id=”@+id/list_myContent” android:layout_width=”match_parent” android:layout_height=”match_parent” android:scrollbars=”vertical” > </ListView> </android.support.v4.widget.NestedScrollView>

Where should ‘app:layout_behavior’ be set?

Check this link: https://developer.android.com/reference/android/support/design/widget/AppBarLayout.html AppBarLayout also requires a separate scrolling sibling in order to know when to scroll. The binding is done through the AppBarLayout.ScrollingViewBehavior class, meaning that you should set your scrolling view’s behavior to be an instance of AppBarLayout.ScrollingViewBehavior. A string resource containing the full class name is available. They mentioned about that, … Read more

Android alphabetical fast scrollview in RecyclerView with Collapsing toolbar

we want some Knowledge of SectionIndexer. Here is Doc of SectionIndexer. We have to set TRUE setFastScrollEnabled(true) method, which is used with the LISTVIEW…….You can use recyclerview instead of listView in the below example…. this is activity public class FastScoll extends ListActivity { ListView fruitView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fast_scoll); fruitView = … Read more

CoordinatorLayout with RecyclerView And Collapsing header

You can achieve it by having this layout: <android.support.design.widget.CoordinatorLayout 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.support.design.widget.AppBarLayout android:layout_width=”match_parent” android:layout_height=”wrap_content”> <android.support.design.widget.CollapsingToolbarLayout android:layout_width=”match_parent” android:layout_height=”match_parent” app:layout_scrollFlags=”scroll|exitUntilCollapsed”> <!– HEADER –> <RelativeLayout … app:layout_collapseMode=”parallax”> ….. </RelativeLayout> <android.support.v7.widget.Toolbar android:layout_width=”match_parent” android:layout_height=”?attr/actionBarSize” app:layout_collapseMode=”pin” /> </android.support.design.widget.CollapsingToolbarLayout> <!– IF YOU WANT TO KEEP “Choose Item” always on top of the RecyclerView, put this TextView here <TextView android:layout_width=”match_parent” android:layout_height=”wrap_content” … Read more

Floating Action Button not showing fully inside a fragment

It’s not an acceptable solution to have to show/hide the FAB whatever tab is selected. I’ve tried every layout combination, but moving the FAB to the activity layout was the only solution that worked. But what if you need the button only in one tab? It’s the only way that works now, but I’m expecting … Read more

CoordinatorLayout using the ViewPager’s RecyclerView

Chris Banes has posted a sample on Github which shows exactly what you want to do. Here is the xml file that defines how one can indirectly attach a coordinator layout to the viewpager’s fragments. <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.support.design.widget.AppBarLayout android:id=”@+id/appbar” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:theme=”@style/ThemeOverlay.AppCompat.Dark.ActionBar”> <android.support.v7.widget.Toolbar android:id=”@+id/toolbar” android:layout_width=”match_parent” android:layout_height=”?attr/actionBarSize” android:background=”?attr/colorPrimary” app:popupTheme=”@style/ThemeOverlay.AppCompat.Light” app:layout_scrollFlags=”scroll|enterAlways” /> <android.support.design.widget.TabLayout … Read more