So, here is what I think is going on... ImageView is basically a container for your actual image. The scaleType indicates how the image should be scaled to fit inside the ImageView. The alignParentBottom affects the container, not the image. That is why you are getting the results in your attached image.
If you set the scaleType to fitXY I would guess that you wouldn't see the blue anymore and all the images would be the same size. Note that this is not what you want to do, because that settings scales X and Y independently, which will cause your images to get stretched and look funny. You could try fitEnd, but I don't know if that will get you exactly what you want: http://developer.android.com/reference/android/graphics/Matrix.ScaleToFit.html#END Ultimately, you might have to come up with your own scale matrix... Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Thu, Jun 28, 2012 at 9:09 PM, Billy Bacon <[email protected]> wrote: > I've searched this forum up and down and found different solutions but > none of them have worked as expected. I even tried looking at the Shelves > project that's open sourced and that seemed much too involved for what I'm > trying to achieve here. > > I have a screen with a bookcase/bookshelf background and have it scrolling > as desired with the code below. My RelativeLayout height does not seem to > be honored and changing it from 100dp to 200dp makes no difference. I > basically need each row in the GridView to be the exact same height and > vertically align the thumbnail image bottom so that the image sites on the > bookshelf. I sort of achieved this by hardcoding the layout width/height > for the ImageView itself. I've tried using a background color so that I can > see what's going on but I still fail to achieve a consistent look. I'm also > trying to scale the images down to a consistent size, let's say 100x100 > even though the images will be different shapes (some are squares and some > are rectangles). I also can't seem to get the image to bottom align in the > RelativeLayout which builds the cell even though I'm using the > android:layout_alignParentBottom="true" attribute. > > Can anyone tell me what I'm doing wrong? I think I'm close although what > I've come up with may be a total hack :-/ > > /res/layout/titles.xml > > <com.alex.android.view.BookShelfView > xmlns:android="http://schemas.android.com/apk/res/android" > android:id="@+id/my_titles_grid_view" > android:cacheColorHint="@android:color/transparent" > android:layout_width="fill_parent" > android:layout_height="fill_parent" > android:numColumns="auto_fit" > android:stretchMode="columnWidth" > android:verticalSpacing="25dp" > android:gravity="bottom"/> > > ImageAdapter > > class ImageAdapter extends BaseAdapter { > private Context mContext; > > public ImageAdapter(Context c) { > mContext = c; > } > > public int getCount() { > return borrowedAssets.size(); > } > > public Object getItem(int position) { > return borrowedAssets.get(position); > } > > public long getItemId(int position) { > return borrowedAssets.get(position).getContentId(); > } > > // create a new ImageView for each item referenced by the Adapter > public View getView(int position, View convertView, ViewGroup > parent) { > > View cellView; > > if (convertView == null) { // if it's not recycled, > initialize some attributes > cellView = > getLayoutInflater().inflate(R.layout.title_cell, null); > ImageView image = (ImageView) > cellView.findViewById(R.id.title_thumbnail); > new > DownloadImageTask(image).execute(getString(R.string.thumbnails_server_url)+borrowedAssets.get(position).getThumbnail()); > } else { > cellView = convertView; > } > > return cellView; > } > } > > /res/layout/title_cell.xml > > > <RelativeLayout > xmlns:android="http://schemas.android.com/apk/res/android" > android:layout_width="100dp" > android:layout_height="100dp"> > > <ImageView android:id="@+id/title_thumbnail" > android:layout_width="100dp" > android:layout_height="140dp" > android:paddingTop="25dp" > android:scaleType="fitStart" > android:layout_alignParentBottom="true" > android:layout_centerHorizontal="true" > android:background="@color/blue_color" > android:contentDescription="thumbnail"/> > > </RelativeLayout> > > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

