Java 类似facebook的元素列表

Java 类似facebook的元素列表,java,android,Java,Android,我想创建一个ap,它在页面底部有一个列表,当我向下滚动屏幕时,屏幕顶部消失,只显示元素列表(当我再次向上滚动时,它再次显示页面顶部)-与facebook应用中相同 我试着实现它,这是我的带有listview和scrollview的xml,但是它没有按预期工作 当我滚动页面时,页面保持原样,并且只有当我滚动列表视图时,列表视图才会下降,但是页面顶部保持不变,列表视图保持不变) 我如何才能在facebook android应用程序中列出相同的列表 非常感谢 <?xml version="1.0

我想创建一个ap,它在页面底部有一个列表,当我向下滚动屏幕时,屏幕顶部消失,只显示元素列表(当我再次向上滚动时,它再次显示页面顶部)-与facebook应用中相同

我试着实现它,这是我的带有listview和scrollview的xml,但是它没有按预期工作

当我滚动页面时,页面保持原样,并且只有当我滚动列表视图时,列表视图才会下降,但是页面顶部保持不变,列表视图保持不变)

我如何才能在facebook android应用程序中列出相同的列表

非常感谢

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fillViewport="true" >

 <RelativeLayout
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:background="#ffffff" >

     <!-- Header  Starts -->

     <LinearLayout
         android:id="@+id/header"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:background="@layout/header_gradient"
         android:paddingBottom="5dip"
         android:paddingTop="5dip" >

         <!-- Logo Start -->
         <!-- Logo Ends -->

         <com.facebook.widget.ProfilePictureView
             android:id="@+id/profilePictureView1"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginLeft="18dp"
             android:layout_weight="1" >
         </com.facebook.widget.ProfilePictureView>

         <TextView
             android:id="@+id/profileNameText"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginTop="80dp"
             android:layout_weight="1"
             android:ems="10"
             android:inputType="textPersonName" />
     </LinearLayout>
     <!-- Header Ends -->

     <ImageView
         android:id="@+id/freinds"
         android:layout_width="50dp"
         android:layout_height="50dp"
         android:layout_alignParentRight="true"
         android:layout_below="@+id/detailsText"
         android:layout_marginRight="40dp"
         android:layout_marginTop="17dp"
         android:src="@drawable/logo" />

     <ImageView
         android:id="@+id/LikeImage"
         android:layout_width="50dp"
         android:layout_height="50dp"
         android:layout_alignTop="@+id/freinds"
         android:layout_marginRight="27dp"
         android:layout_toLeftOf="@+id/freinds"
         android:src="@drawable/logo" />

     <TextView
         android:id="@+id/detailsText"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_below="@+id/header"
         android:layout_marginTop="16dp"
         android:layout_toLeftOf="@+id/freinds"
         android:ems="10"
         android:inputType="textMultiLine" >

         <requestFocus />
     </TextView>

     <LinearLayout
         android:id="@+id/linearLayout1"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_alignParentLeft="true"
         android:layout_below="@+id/freinds" >

         <Button
             android:id="@+id/registerTwitter"
             android:layout_width="0dp"
             android:layout_height="fill_parent"
             android:layout_weight="1"
             android:text="Sale" />

         <Button
             android:id="@+id/registerFB"
             android:layout_width="0dp"
             android:layout_height="fill_parent"
             android:layout_weight="1"
             android:text="Deliver" />

         <Button
             android:id="@+id/clearCredentials"
             android:layout_width="0dp"
             android:layout_height="fill_parent"
             android:layout_weight="1"
             android:text="Group" />
     </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_below="@+id/linearLayout1"
        android:orientation="vertical" >

                <EditText android:id="@+id/EditText01"
                                android:layout_height="wrap_content"
                                android:layout_width="fill_parent"
                                android:hint="Search">                               
                </EditText>

                <ListView android:id="@+id/ListView01"
                                android:layout_height="wrap_content"
                                android:layout_width="fill_parent">
                </ListView>

    </LinearLayout>

 </RelativeLayout>

</ScrollView>

我认为您需要的不仅仅是xml布局,还有一点复杂,但可能我不理解,请尝试播放一些滚动视图事件


您希望在用户向上滚动时立即显示页面顶部,因此需要注册到滚动视图的onscroll事件,并检查滚动方向,以显示页面顶部。这更清楚吗?

嗨,谢谢你的回答,我不明白你的意思,你能给我举个例子吗?我不知道滚动查看事件将如何帮助我