title: How to Set image size in grid view
body: <p>I have a grid view with 3 columns wrapped in a relative layout.
  At the moment the view on a large device (7 inch tablet) appears small so I want to increase the size of the images according to the screen size.</p>
  
  <p>My getView() in baseApdter for the Gridview:</p>
  
  <pre><code>@Override
      public View getView(int position, View convertView, ViewGroup parent) {
          AppInfo entry = mListAppInfo.get(position);
  
          //create a new ImageView and TextView for each item refernced by teh adpter
  
  
          if(convertView == null) {
  
              //if its not recycled, intilise some attributs
  
              LayoutInflater inflater = LayoutInflater.from(mContext);
              convertView = inflater.inflate(R.layout.layout_appinfo, null);
          }
  
          //want to change the soze of the image according to screensize then place in the gridview with this apdter
  
  
          ImageView ivIcon = (ImageView)convertView.findViewById(R.id.ivIcon);
  
          //ivIcon.setLayoutParams(new GridView.LayoutParams(
                  //(int)mContext.getResources().getDimension(R.dimen.widthImageGridview),
                  //(int)mContext.getResources().getDimension(R.dimen.heihgtImageGridview)));
          ivIcon.setLayoutParams(new RelativeLayout.LayoutParams(85, 85));
          ivIcon.setScaleType(ImageView.ScaleType.CENTER_CROP);
          ivIcon.setPadding(8, 8, 8, 8);
          ivIcon.setImageBitmap(entry.getIcon());
  
          TextView tvName = (TextView)convertView.findViewById(R.id.tvName);
          tvName.setText(entry.getName());
          tvName.setTextColor(Color.WHITE);       
          return convertView;
      }
  </code></pre>
  
  <p>And my XML with grid view:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/background"
      tools:context=".Main" &gt;
  
          &lt;GridView
          android:id="@+id/gvMain"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:columnWidth="200dip"
          android:gravity="center"
          android:horizontalSpacing="40dip"
          android:numColumns="3"
          android:padding="10dip"
          android:stretchMode="columnWidth"
          android:verticalSpacing="10dip" /&gt;
  
      &lt;Button
          android:id="@+id/btn_facebook"
          android:layout_width="45dp"
          android:layout_height="45dp"
          android:layout_alignParentBottom="true"
          android:layout_alignParentRight="true"
  android:paddingRight="10dp"
  android:paddingBottom="10dp"
          android:background="@drawable/fb_button" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Trying to use the imageView.setLayoutparams(...) throws </p>
  
  <blockquote>
    <p>java.lang.ClassCastException:
    android.widget.RelativeLayout$LayoutParams cannot be cast to
    android.widget.LinearLayout$LayoutParams</p>
  </blockquote>