Found the issue,

    app:layout_behavior="@string/appbar_scrolling_view_behavior"


should be set on the SwipyRefreshLayout, not on the ListView.


Thanks,
Angel



On Sun, Jan 31, 2016 at 1:14 PM, Angel Todorov <[email protected]> wrote:

> hey,
>
> Thanks for the feedback. I'm setting the scroll flags and scroll
> behaviors, here's my code (below). The issue with AppBarLayout as a first
> child is that whenever I set it inside of a relative layout, which is a
> child of the CoordinatorLayout, the scrolling behavior doesn't work. I
> guess I wasn't clear enough - it should be somewhere in the direct children
> of the CoordinatorLayout, if it's a child of a child, the coordinator
> layout doesn't pick it up.
>
> My issue is not with the scrolling behavior - that works perfectly fine.
> my issue is that the content is overlapped by the app bar. The only way to
> fix this is to use a relative layout and set layout_below, but then the
> scrolling behavior stops working.
>
> <?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";
>     xmlns:tools="http://schemas.android.com/tools";
>     android:layout_width="match_parent"
>     android:layout_height="wrap_content"
>     android:id="@+id/coordinator"
>     android:fitsSystemWindows="true"
>     tools:context="com.example.todorov.myapplication.MainActivity">
>     <android.support.design.widget.AppBarLayout
>         android:id="@+id/appbar"
>         android:layout_width="match_parent"
>         android:layout_height="wrap_content"
>         android:theme="@style/AppTheme.AppBarOverlay">
>
>         <android.support.v7.widget.Toolbar
>             android:id="@+id/toolbar"
>             android:layout_width="match_parent"
>             android:gravity="center"
>             android:backgroundTint="#0288D1"
>             android:layout_gravity="center"
>             android:layout_height="?attr/actionBarSize"
>             android:background="?attr/colorPrimary"
>             app:popupTheme="@style/AppTheme.PopupOverlay"
>             app:layout_scrollFlags="scroll|enterAlways">
>             <TextView
>                 android:layout_width="wrap_content"
>                 android:layout_height="wrap_content"
>                 android:text="Toolbar Title"
>                 android:textSize="25dp"
>                 android:textColor="#ffffff"
>                 android:layout_gravity="center"
>                 android:id="@+id/toolbar_title" />
>         </android.support.v7.widget.Toolbar>
>
>     </android.support.design.widget.AppBarLayout>
>
>     <include layout="@layout/content_matches"
>         android:layout_width="match_parent"
>         android:layout_height="match_parent"
>         />
>
> <!--
>     <android.support.design.widget.FloatingActionButton
>         android:id="@+id/fab"
>         android:layout_width="wrap_content"
>         android:layout_height="wrap_content"
>         android:layout_gravity="bottom|end"
>         android:layout_margin="@dimen/fab_margin"
>         android:src="@android:drawable/ic_dialog_email" />
>         -->
>
> </android.support.design.widget.CoordinatorLayout>
>
>
> Here is content_matches.xml:
>
> <?xml version="1.0" encoding="utf-8"?>
> <com.orangegangsters.github.swipyrefreshlayout.library.SwipyRefreshLayout
>     xmlns:app="http://schemas.android.com/apk/res-auto";
>     xmlns:android="http://schemas.android.com/apk/res/android";
>     android:id="@+id/swipe_container"
>     android:layout_width="match_parent"
>     android:layout_height="wrap_content"
>     app:direction="both">
>
> <ListView xmlns:android="http://schemas.android.com/apk/res/android";
>     android:id="@android:id/list"
>     android:layout_width="wrap_content"
>     app:layout_behavior="@string/appbar_scrolling_view_behavior"
>     android:cacheColorHint="#00000000"
>     android:layout_height="wrap_content"/>
> </com.orangegangsters.github.swipyrefreshlayout.library.SwipyRefreshLayout>
>
>
> I've also tried moving the list view outside of the SwipyRefreshLayout -
> didn't change anything. Also want to clarify that i am setting the
> following in code, so that I don't have to use a RecyclerView or another
> view that supports nested scrolling - because the ListView on its own
> doesn't support nested scrolling, and coordinator layout's scrolling
> behavior expects a content view which supports nested scrolling:
>
>
> listview.setNestedScrollingEnabled(true);
>
> ViewCompat.setNestedScrollingEnabled(listview, true);
>
>
>
> Thanks again,
> Angel
>
>
>
> On Sunday, January 31, 2016 at 7:02:27 AM UTC+2, TreKing wrote:
>>
>>
>> On Fri, Jan 29, 2016 at 10:53 AM, Angel Todorov <[email protected]>
>> wrote:
>>
>>> The problem is that the coordinator layout always expects an
>>> AppBarLayout as its first child
>>
>>
>> That's not true ...
>>
>>
>>> , therefore i cannot put a relative layout in order to adjust the
>>> positions of my content view relative to the toolbar.
>>
>>
>> You shouldn't have to use a RelativeLayout. Putting a views in a
>> coordinator with the right scroll flags and scrolling behaviors set should
>> lay them out correctly.
>>
>>
>>> What happens is that the content view starts from the beginning of the
>>> screen, and the toolbar overlaps it.
>>
>>
>> Without more to go on, I'm guessing you're missing scroll flags or a
>> scroll behavior.
>>
>> You should post your layout and screenshot of what it looks like.
>>
>>
>> -------------------------------------------------------------------------------------------------
>> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
>> transit tracking app for Android-powered devices
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Android Developers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/android-developers/rDArIELx8EM/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/android-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/android-developers/c8bc86dd-5105-495b-b10b-0c0bbecab356%40googlegroups.com
> <https://groups.google.com/d/msgid/android-developers/c8bc86dd-5105-495b-b10b-0c0bbecab356%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/CAAwEjvCN6HcYubpjpb_AuTKszyp2NF_pcpprNvOhe1f_hRz52g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to