Is there anyway so I can align bitmap in ImageView. I have an issue with my image view. I'm setting it's source via Java Code and after bitmap is resized it's centered in ImageView, but the thing that I want is to align the bitmap.
Declaring the imageView :
    <RelativeLayout
    android:id="@+id/collection_background"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@+id/actionbar" > 
     <ImageView  
        android:id="@+id/collection_image_background"
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:background="#ffffff"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:contentDescription="@string/stampii"  />
    // countinue ........
and here is how I'm setting the bitmap :
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);
Any ides how to do that?
Add android:scaleType="fitStart" to your ImageView. It is ok for me.
You can use android:scaleType to change the alignement in your ImageView.
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