I'm following along the HelloWorld tutorials for Android but when I do the GridView exercise (http://developer.android.com/resources/tutorials/views/hello-gridview.html)
I found that if I comment out the line: imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
Then everything works. I did some research and found that GridView.LayoutParams does not exist. Am I doing something wrong? Is the tutorial broken?
I did some research and found that GridView.LayoutParams does not exist.
Where did you research? GridView.LayoutParams does exist. LayoutParams is a class inherited from the ViewGroup class, which is the super class of GridView.
Edit:
Just took a look and it seems that, as you said, LayoutParams are not accessible from GridView. Use AbsListView.LayoutParams instead.
GridView.LayoutParams is actually AbsListView.LayoutParams, so you can safely use that instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With