lawloretienne / QuickReturn

Showcases QuickReturn UI Pattern as either a header, footer, or both header and footer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

First and Second Item from ListView Is Covered By QRHeader (in Example Code)

alukito opened this issue · comments

Hello, thanks for creating such a nice library.

I was running the example code and found that the first and second item from R.array.countries (United States Of America and Afghanistan) was covered by the header. I'm trying to scroll up and down, but it still cannot show the first and second item.

Screenshot:
quickreturnitemnotshown

After checking the layout (fragment_list_quick_return_header.xml), I find that the problem is in the layout. The CustomTextView and the ListView do not have the position set between each other.

Edit: I try to change the layout:

<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">

    <com.etiennelawlor.quickreturn.views.CustomFontTextView
        android:id="@+id/quick_return_tv"
        android:layout_width="match_parent"
        android:layout_height="80dp"
        android:background="@color/transparent_black_ninty"
        android:textSize="22sp"
        android:text="@string/header"
        android:textColor="@android:color/white"
        android:gravity="center"
        app:textFont="Roboto_Bold"/>

    <ListView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@android:id/list"
        android:layout_below="@id/quick_return_tv"/>

</RelativeLayout>

After I change the layout into the code above, the first and second item is now shown but there is now a white gap on top of the list when scrolling.

quickreturnwhitegap

Thanks for your help.

That would be great if you could provide a pull request for this issue.

On Sun Jan 25 2015 at 6:38:09 AM Andreas Lukito notifications@github.com
wrote:

Hello, thanks for creating such a nice library.

I was running the example code and found that the first and second item
from R.array.countries (United States Of America and Afghanistan) was
covered by the header. I'm trying to scroll up and down, but it still
cannot show the first and second item.

Screenshot:
[image: quickreturnitemnotshown]
https://cloud.githubusercontent.com/assets/708537/5891816/42390678-a4da-11e4-9d78-71cb6cbb6ec1.png

After checking the layout (fragment_list_quick_return_header.xml), I find
that the problem is in the layout. The CustomTextView and the ListView do
not have the position set between each other. After I change the layout
into the code below, it solve the problem.

<com.etiennelawlor.quickreturn.views.CustomFontTextView
    android:id="@+id/quick_return_tv"
    android:layout_width="match_parent"
    android:layout_height="80dp"
    android:background="@color/transparent_black_ninty"
    android:textSize="22sp"
    android:text="@string/header"
    android:textColor="@android:color/white"
    android:gravity="center"
    app:textFont="Roboto_Bold"/>

<ListView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@android:id/list"
    android:layout_below="@id/quick_return_tv"/>

Hope it helps, I can provide a pull request if you want me to. Thanks


Reply to this email directly or view it on GitHub
#14.

Hi, I'm sorry, I thought layout change would solve the problem, but it didn't. So I edited my comment regarding the issue, but i forgot to add "Edit:" tag.

When I set the position of the ListView to be below of the CustomTextView, the first and second item appears. But the problem is when the ListView is scrolled, the CustomTextView is translated above while RelativeLayout still thinks CustomTextView is at its original position. I think this is because of the fact that setTranslationY happens post-layout.

The effect can be seen in the screenshot in my updated comment earlier.

To be honest, I don't have a solution right now. Maybe if you point me to right direction, I could help you with fixing. Thanks a lot.

I have the same issue. Are there any solutions yet?

I have a workaround for this issue. I created a dummy list item and put it as the first element of the list. This dummy item has the exact height of the quick return header view. This way, the top items of the list are visible.

You can add a header to the listView (listView.addHeaderView) to avoid covering the items as a workaround. You should set the header height the same as the QuickReturn view height.

@evliya I believe that is exactly how I would handle it too. Creating a dummy list item to be the exact height of the quick return header view. I am doing something similar in the Twitter example.