首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

Android GridView展示一行,左右滑动

2013-10-24 
Android GridView显示一行,左右滑动最近项目需要用到这个功能,研究了一下,实现过程如下:gridViewAdapter

Android GridView显示一行,左右滑动

最近项目需要用到这个功能,研究了一下,实现过程如下:

gridViewAdapter = new GridViewAdapter(mContext, list1);

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:padding="3dp" >    <ImageView        android:id="@+id/ImageIcon"        android:layout_width="100dp"        android:layout_height="90dp"        android:src="@drawable/card_detaild_small"        android:scaleType="fitXY" /></RelativeLayout>

注意:代码里给的宽度比gridview_item.xml的宽度多1,即101,这样显示比较好看一下,不会因为过窄而显示不全。

热点排行