Помогите придумать как сделать так: Имеется список чего то, к примеру новостей и вверху этого списка есть картинка, которая если я сделаю свайп вниз то она увеличится и загрузится новая порция новостей. Подскажите как сделать само увеличение при свайпе вниз, не могу ничего придумать. На картинках то что мне примерно нужно
UPD:
Спасибо pavlofff за ссылку. Но у меня не получается сделать SwipeRefreshLayout
вместе с StretchLayout
. Пробовал много рас, но ошибка. Вот мой xml
<menuobject.StretchLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe"
android:layout_width="wrap_content"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/menuImageI"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="centerCrop" />
<RelativeLayout
android:id="@+id/front_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f1f1f1"
android:orientation="vertical" >
<ListView
android:id="@+id/listCategoryMenu"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
/>
</RelativeLayout>
</android.support.v4.widget.SwipeRefreshLayout>
</menuobject.StretchLayout>
В классе StretchLayout
изменил строки:
mStretchView = getChildAt(0);
mFrontView = getChildAt(1);
на
mStretchView = getChildAt(1);
mFrontView = getChildAt(2);
И ошибки:
06-09 23:33:02.597: E/AndroidRuntime(20015): FATAL EXCEPTION: main
06-09 23:33:02.597: E/AndroidRuntime(20015): java.lang.NullPointerException
06-09 23:33:02.597: E/AndroidRuntime(20015): at menuobject.StretchLayout.onLayout(StretchLayout.java:68)
06-09 23:33:02.597: E/AndroidRuntime(20015): at android.view.View.layout(View.java:11315)
06-09 23:33:02.597: E/AndroidRuntime(20015): at android.view.ViewGroup.layout(ViewGroup.java:4314)
06-09 23:33:02.597: E/AndroidRuntime(20015): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1633)
68 строка:
mMargin = mStretchView.getMeasuredHeight()*mRatio;
StretchLayout
не подойдет.Я изменил ответ, снимите отметку, что он правильный, если такой вариант вам не подходит.