2014-03-18 73 views
0

我在我的android应用程序中使用gridview。现在,由于某些原因,我正在使用自建的“假”ActionBar,它由我的布局顶部的一个简单的LinearLayout组成。如何在Android中设置GridView的滚动位置?

现在,我想实现的效果与应用程序QuickPic中的效果类似。当你在gridview中向下滚动时,gridview最初应该在aciton bar下面开始并在其后面流动。

实际的问题是,我如何将gridview放置在我的动作栏(LinearLayout)下方并仍然让它流动到它的后面?

这是我到目前为止有:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

<LinearLayout 
    android:id="@+id/fake_action_bar" 
    android:layout_width="match_parent" 
    android:layout_height="80dp" 
    android:paddingTop="25dp" 
    android:background="@color/actionbar_color" > 

    // Here normally would be more stuff for the action bar (text, buttons, etc.) 

</LinearLayout> 
<GridView 
    android:id="@+id/grid_view" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_marginTop="80dp" 
    android:numColumns="auto_fit" 
    android:gravity="center" 
    android:stretchMode="columnWidth"> 
</GridView> 
</FrameLayout> 

回答