类似Android 4.0 Gallery的GridView布局
我正在尝试使用GridView创建一个图像库索引,该索引看起来类似于冰激凌三明治。哪个库应用程序: (对不起,我还不能使用img标签) 我看了所有的常用教程(例如),但没有一本真正给出我想要的 现在我有以下几点:类似Android 4.0 Gallery的GridView布局,android,gallery,android-4.0-ice-cream-sandwich,Android,Gallery,Android 4.0 Ice Cream Sandwich,我正在尝试使用GridView创建一个图像库索引,该索引看起来类似于冰激凌三明治。哪个库应用程序: (对不起,我还不能使用img标签) 我看了所有的常用教程(例如),但没有一本真正给出我想要的 现在我有以下几点: <GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gridview" android:layout_width="fill_parent" android:
<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:columnWidth="100dp"
android:numColumns="auto_fit"
android:verticalSpacing="2dp"
android:horizontalSpacing="2dp"
android:stretchMode="none"
android:gravity="center"
android:layout_weight="1"
android:background="#000000"/>
它很接近,但感觉真的不一样,我不确定它是否能在所有设备上都很好地扩展。有人知道这样使用GridView的方法吗?或者我应该考虑使用另一个小部件,例如
谢谢。正如您提到的,您已从中拍摄了ImageAdapter 在这里,我建议您创建一个自定义适配器类,遵循以下步骤:
要查找示例,请搜索“Android GridView示例”并滚动到我的博客链接,您将获得它。这里我无法粘贴它。您为GridView定义了自定义适配器吗?@PareshMayani是的,我使用了从ImageAdapter这里获取的自定义适配器:这就是我所做的,很接近,但它仍然没有ICS gallery那么好看。感觉有点木讷。
imageView = new ImageView(mContext);
imageView.setLayoutParams(new GridView.LayoutParams(148,148));
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);