如何简单应用GridView
操作方法
- 01
通过改写了个小demo来实现显示商品尺寸并设置选中效果,即改变Gridview中控件的背景颜色或背景图 实例如下: [mw_shl_code=java,true]package com.beyondsoft.gridviewdemo; import java.util.ArrayList; import java.util.Map; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.Color; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.GridView; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.RelativeLayout.LayoutParams; import android.widget.TextView; public class GridViewDemo extends Activity implements OnItemClickListener{