网格视图(GridView)

GridView的视图排列方式与矩阵类似,当屏幕上有很多元素需要显示时,可以使用GridView。

既然有多个元素需要显示,就需要使用BaseAdater来存储这些元素。当需要选择其中一个元素进行操作,这就需要设置事件监听setOnItemClickListener来捕捉和处理事件。

通过XML布局来实现:

<?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/gridview"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    android:numColumns="auto_fit"
    android:verticalSpacing="10dp"
    android:horizontalSpacing="10dp"
    android:columnWidth="90dp"
    android:stretchMode="columnWidth"
    android:gravity="center"
/>

 

源码下载链接:http://www.apkbus.com/android-117111-1-1.html

 

喜欢开源,乐意分享的大神们,欢迎加入QQ群:176507146,你值得拥有哦!

相关文章:

  • 2021-07-16
  • 2022-01-21
  • 2021-08-31
  • 2021-06-27
  • 2021-08-13
  • 2021-07-27
  • 2021-06-30
  • 2021-10-30
猜你喜欢
  • 2021-08-06
  • 2021-09-17
  • 2022-02-25
  • 2021-06-24
  • 2021-11-30
  • 2021-11-04
  • 2021-10-25
相关资源
相似解决方案