我正在使用需要2列网格视图的应用。我想在第一列中只显示一张图片,然后在所有其他列中显示两张图片。
我的网格视图:
<GridView
android:id="@+id/grid"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fadingEdge="none"
android:horizontalSpacing="3dip"
android:numColumns="2"
android:verticalSpacing="3dip" />
我目前的观点 ![在此输入图像说明] [1]
并查看我想
![在此输入图片说明] [2]
答案 0 :(得分:3)
我建议你把这个图像放在GridView Header中,因为这种东西会在开发过程中出现一些问题而且会变得复杂。所以将一个图像放在标题中,剩下的都在gridview中。一切都会好起来的。请参阅下面的标题示例:
private View headerView;
headerView = inflater.inflate(R.layout.YOUR HEADER LAYOUT, null, false);//YOUR HEADER LAYOUT is a xml file with the content which you need to display in header, in your case its ImageView only.
ImageView imageview;
imageview = (ImageView) headerView.findViewById(R.id.YOUR IMAGEVIEW NAME);
gridview.addView(headerView);
gridview.setAdapter(YOUR ADAPTER);