I am trying to align the image at the top of my Relative Layout and after that center horizontally. Here is the code I use for:
<ImageView android:id="@+id/collection_image_background" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" />
but this code does not work. My image is centered but not aligned at the top of my relative layout. I tried using android:scaleType="fitStart" , but actually aligned the image to the left and top of its parent.
So, any idea how I can align the image correctly when I need to?
PS I forget to mention that I set the image to my ImageView as follows:
BitmapFactory.Options o2 = new BitmapFactory.Options(); o2.inTempStorage = new byte[8*1024]; ops = BitmapFactory.decodeStream(cis,null,o2); ImageView view = (ImageView) findViewById(R.id.collection_image_background); view.setImageBitmap(ops);
Android Droid
source share