示例Captcha:
以下是适配器的代码:
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView=new ImageView(context);
imageView.setImageBitmap(list.get(position).getBitmap());
imageView.setLayoutParams(new AbsListView.LayoutParams(
(int) (parent.getWidth() / DataUtils.num),//DataUtils.num=3
(int) (parent.getHeight() / DataUtils.num)));
return imageView;
}
GridView的XML:
<GridView
android:id="@+id/gv_paly"
android:layout_below="@id/ll_top"
android:layout_above="@id/ll_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
></GridView>
请问,如何减少CAPTCHA图像之间的差距,使其更专业?
答案 0 :(得分:1)
使用android:stretchMode和android:horizontalSpacing。 这将在视图之间产生修复差距。您可以将其设置为0。
&B::RunThis
<GridView
android:stretchMode="columnWidth"
android:horizontalSpacing="10dp"
android:verticalSpacing="10dp"
android:id="@+id/gv_paly"
android:layout_below="@id/ll_top"
android:layout_above="@id/ll_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</GridView>