Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change view height during scroll #51

Open
pawelantczak opened this issue Jan 19, 2015 · 2 comments
Open

Change view height during scroll #51

pawelantczak opened this issue Jan 19, 2015 · 2 comments

Comments

@pawelantczak
Copy link

Hello.
I have two views. One is ImageView and the other is ObservableListView. Both wrapper in group view:

<android.support.v4.widget.SwipeRefreshLayout
    android:id="@+id/refresh"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="org.antczak.whereIsMyPackage.activity.DetailsActivity">


    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <ImageView
            android:id="@+id/infos"
            android:src="@drawable/bamboo"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:scaleType="centerCrop"/>

        <com.github.ksoichiro.android.observablescrollview.ObservableListView
            android:id="@+id/scroll"
            android:layout_below="@id/infos"
            android:layout_width="match_parent"
            android:layout_height="fill_parent"/>

    </RelativeLayout>
</android.support.v4.widget.SwipeRefreshLayout>

What I want to achieve is to gradually hide image during list scrolling. Using ViewHelper.setTranslationY I'm able to slide up image, but it's container is still there.
I want the list to fill space which image released.
Now it looks like one screenshot
How to reduce image container height during scroll?

@ksoichiro
Copy link
Owner

Sorry for my late reply.
Have you solved your issue?
I think one of the following might solve your issue...

  • Resize ListView on onScrollChanged
    • Like this: listView.getLayoutParams().height = xxx; listView.requestLayout();
    • But this might cause bad scrolling animation
  • Set transparent padding view as the header to the ListView
    • Like FlexibleSpaceWithImageListViewActivity (in the sample app) does

@theonlyanil
Copy link

I could only achieve to make the listView scroll along with imageView. But it maintains its height, causing blank space on bottom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants