Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了如何设置具有不同列大小的Android GridView大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我的主布局中有一个GridView,如下所示:

<LinearLayout xmlns:android="http://@R_489_10906@mas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <GridView
        xmlns:android="http://@R_489_10906@mas.android.com/apk/res/android"
        android:id="@+id/gridview"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:gravity="center"
        android:horizontalSpacing="1dp"
        android:stretchMode="columnWidth"
        android:verticalSpacing="1dp" />

</LinearLayout>

它产生这样的网格

每个单元格的内容是这样的布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://@R_489_10906@mas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:BACkground="@drawable/btn_measurement" >

    <Button
        android:id="@+id/numerical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="---" />

</LinearLayout>

但我希望第四列是其他列的三分之一,我不能.

我检查了链接

GridView with different column sizesAndroid GridView Column Stretching

但他们没有任何帮助.

本图文内容来源于网友网络收集整理提供,作为学习参使用,版权属于原作者。

大佬总结

以上是大佬教程为你收集整理的如何设置具有不同列大小的Android GridView全部内容,希望文章能够帮你解决如何设置具有不同列大小的Android GridView所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。