image - Android crop imageview -


there imageview

<imageview     android:id="@+id/image"     android:layout_width="match_parent"     android:layout_height="150dp" /> 

i load image imageview using picasso library.

picasso.with(getactivity()).load(url)                             .config(bitmap.config.rgb_565)                             .into(imageview); 

there problem there padding inside imageview , loaded image.

there image show padding: padding

i use .fit() method avoid gap, image stretches , quality losts.

(you can see dark-blue circles ovals now) enter image description here

the question is: should avoid loosing quality of image , resize directly imageview. can't add .centercrop() because left side of image logical safe-zone. can't change layout_height="150dp" because break layout.

anyway thank you!

look @ imageview:

<imageview android:id="@+id/image" android:layout_width="match_parent" android:layout_height="150dp" /> 

you forcing image stretch width of parent view (the screen maybe?). try using wrap_content width , keeping height same. may cause image shrink, desired ux.

@stefs found adding this:

...android:adjustviewbounds="true" />

would help. check out post here.

if want static image sizes, may have deal padding.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -