It can be solved by importing [any layout].LayoutParams
eg.
import android.widget.GridLayout.LayoutParams;
Although its not clear to me what should be the criteria to choose which package to import.
To solve the problem
the constructor AbsListView.LayoutParams(int, int, float) is undefined
make sure the third argument is also an "int" it should be :
LayoutParams cannot be resolved to a variable on a line of code which is as follows tv.setLayoutParams(new GridView.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1));