Reputation: 11
I have many ImageViews in ViewFlipper. Each ImageView has ScaleType set to FIT_START so images are "stick" to the top. Now I have problem with vertical images - they go to left, and I want to center them. I cant combine FIT_START and CENTER so I'm looking for another solution. Any ideas?
Thanks!
ImageView iv = new ImageView(getApplicationContext());
iv.setImageBitmap(bm);
iv.setAdjustViewBounds(true);
iv.setScaleType(ScaleType.CENTER_INSIDE);
flipper.addView(
iv,
new LayoutParams(LayoutParams.MATCH_PARENT,
(int) Utils.dp2px(256,
getApplicationContext())));
<ViewFlipper
android:id="@+id/view_flipper"
android:layout_width="match_parent"
android:layout_height="256dp"
android:autoStart="false"
android:flipInterval="0" >
</ViewFlipper>
Upvotes: 1
Views: 655
Reputation: 75629
I suspect your ImageView's width is set to wrap_content
. You can try setting it to fill_parent
instead
Upvotes: 1