I am trying to make a GridView
programmatically in my java class and it all works fine. The problem is the auto-generated 5 pixel padding around the GridView
. In the xml I manage to remove it using:
android:listSelector="@null"
But I do not manage to do anything similar in java. I have tried some workarounds like making the GridView
10 pixels larger then the actual screen with no luck.
Does anyone have any code for this?
Edit:
The answer by me does not solve the problem. There is still a bounty going.
Here is my GridView
code:
GridView gridView = new GridView(this);
gridView.setNumColumns(someInt);
gridView.setAdapter (new MyCustomAdapter(this));
gridView.setLayoutParams(new GridView.LayoutParams(
customValue,
LayoutParams.FILL_PARENT,
Gravity.CENTER_HORIZONTAL)
);