Android, ImageView
•
Android
I'm trying to use a paintable PNG to get my ImageView to fill the display (I don't care about the ratio). However, fill_ Parent doesn't work. As far as I know, no background is set to relativelayout?
to greet
RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:onClick="toggleAdvice"
ImageView
android:id="@+id/advice_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/pratbubbla_gron"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
resolvent:
I stretch / cut ImageView programmatically. Maybe this code can help you:
ImageView imageView=new ImageView(context);
imageView.setAdjustViewBounds(true);
imageView.setImageBitmap(bitmap);
imageView.setMaxHeight(maxHeight);
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
layout.addView(imageView);
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码