如何创建Android中头一个bouncable滚动视图? [英] how to create a bouncable scrollview with header in android?
问题描述
我想在我的项目bouncable滚动视图(iPhone等)。我找到的反弹时的一些文章,并使用它像这这里的类。但我不知道如何设置了滚动视图作为它的头。
我也试过只是我的自定义滚动视图之前添加的视图,但它没有工作(codeS在年底)。
我需要连接到滚动型我怎么能做到这一点的看法?任何想法会很感激。
<的LinearLayout
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentTop =真
机器人:背景=#FF8080
>
< ImageView的
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT/>
< / LinearLayout中>
< com.amix.tstsrc.MyScrollView
机器人:ID =@ + ID / my_scrollView
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
机器人:layout_centerHorizontal =真
机器人:layout_centerVertical =真
>
<的LinearLayout
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:背景=#8585FF>
<的TextView
机器人:ID =@ + ID / help_text
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:文字颜色=@机器人:彩色/白/>
< / LinearLayout中>
< /com.amix.tstsrc.MyScrollView>
请通过的https:/ /github.com/Larphoid/android-Overscroll-ListView 。我希望这是你在找什么。
在情况下,你想用头滚动型头的地方停留,并在列表滚动和反弹然后尝试使用,而不是滚动型addHeaderView去列表视图。
I want a bouncable scrollview (iPhone like) in my project. I find some articles about overscroll and use it like This class here. But i dont know how to set over scroll view as its header.
I also tried adding a view simply before my custom scroll view but it didn't work (codes at the end).
I need a view attached to scrollview how can i do this? any idea will be grateful.
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#FF8080"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<com.amix.tstsrc.MyScrollView
android:id="@+id/my_scrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#8585FF">
<TextView
android:id="@+id/help_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white" />
</LinearLayout>
</com.amix.tstsrc.MyScrollView>
Please go through https://github.com/Larphoid/android-Overscroll-ListView. I hope this is what you are looking for.
In case you want scrollview with header where header stays and the list scrolls and bounces then try to go for listview by using addHeaderView instead of Scrollview.
这篇关于如何创建Android中头一个bouncable滚动视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!