• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps imageview wrap_content problem

android46

Lurker
hello everyone and thanks for your helps.

i ve a project on google android studio.

i m using an imageview inside vertical linearlayout.

here my parameters;

[HIGH]<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/imageView2"
android:src="@drawable/myimg" />[/HIGH]

in attachment you can see my image (red block) and imageview borders (blue line)
there is no problem with width, it is %100 of my layout, but i want my image to fit the area while keeping the aspect ratio. as you can see in my attachment there are white spaces, the imageview height is bigger than my image, how can i fit image in imageview?
 

Attachments

  • q.jpg
    q.jpg
    38 KB · Views: 125
Does the ImageView have to be that size?
You could try wrapping the height of the ImageView and then adjusting the ImageViews top and bottom margin properties. just a quick idea, I havnt actually tested it.
 
Back
Top Bottom