我正在努力实现以下 GUI:
对于红线下方的 9 个元素(红线下方的所有内容都应该是可滚动的),我使用了按预期工作的 gridview 布局。但实际上我不知道如何制作页眉。
到目前为止我的 xml:
<RelativeLayout 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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background = "@drawable/t"
tools:context=".AppStarter" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<GridView
android:id="@+id/gridview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numColumns="3"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:stretchMode="columnWidth"
android:gravity="center"
android:layout_marginLeft="2sp"
android:layout_marginRight="5sp"
android:layout_marginTop="0sp" />
</LinearLayout>
</RelativeLayout>
我的想法是在 gridview 上添加一个额外的 linearLayout,但这种方法没有产生预期的结果。有什么想法可以实现这个 header 吗?
提前致谢!
最佳答案
你可以试试我自己的实现。经过多次尝试,我决定编写自己的代码!
关于Android gridview 和自定义标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20668112/