android Gridview 移动一列

标签 android gridview shift

我需要像这样在 gridview 中实现移位列

enter image description here

但只有两列。 我已经尝试在适配器中使用两种不同类型,但它没有解决我的任务 enter image description here

在我看来,我将不得不扩展 gridview 和 ovverride onDraw 方法,但也许已经存在其他解决方案或库?

最佳答案

这可以通过布局 XML 文件完成。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<LinearLayout
    android:id="@+id/header"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:padding="5dp" >

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
      />

</LinearLayout>

<GridView
    android:id="@+id/grid"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@id/header"
    android:cacheColorHint="#0000"
    android:columnWidth="100dp"
    android:horizontalSpacing="5dp"        
    android:numColumns="2"
    android:stretchMode="columnWidth"
    android:verticalSpacing="5dp" />

</RelativeLayout>

关于android Gridview 移动一列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25645189/

相关文章:

android - FailedBinderTransaction-TransactionTooLargeException

c# - 我怎样才能在 gridview 中获取超链接的值(value)?

perl - 谁能用 Perl 解释一下(我的 $self = shift)

objective-c - SInt32 和 << 的问题

android - 无法在 Android 的弹出菜单中创建 "Share"菜单

python - 使用 pandas 数据框按索引进行移位

android - ORMLite 使用谓词选择一些列

Android 应用内计费查询

android - 多个ADB客户端可以通过无线连接到单个Android ADBD吗

java - 尽管为 api 11 及更高版本设置了 list ,但 Android api 级别 14 上的 GridView 崩溃