Here is a gridview: [test_grid.xml]
<RelativeLayout xmlns:android="http:....."
android:layout_height="match_parent"
android:layout_width="match_parent">
<GridView
android:id="@+id/grid_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:numColumns="6"
android:verticalSpacing="0dp"
android:horizontalSpacing="0dp"
android:stretchMode="columnWidth"
android:gravity="center"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
>
</GridView>
</RelativeLayout>
and an imageview: image_item.xml
<RelativeLayout xmlns:android="http:....."
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:id="@+id/imageLetter"
android:padding="0dp" />
</RelativeLayout>
And in GridAdapter.java
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater)
mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if(convertView==null){
convertView=inflater.inflate(R.layout.item_list,parent,false);
}
ImageView imageView=(ImageView)convertView.findViewById(R.id.imageLetter);
imageView.setImageResource(mThumbIds[position]);
return imageView;
Problem is: couldn't remove padding around imageview, enter image description here I tried this:
imageView.setPadding(0,0,0,0);
but no results. Appreciate any help, advice.