简体   繁体   中英

how to use Picasso library to cut the image from bottom only

I'm using the below code to load the image into an imageView.I want to cut the image from the bottom only. how can I do this using Picasso Tried center-crop and image cut from top and bottom

  Picasso.with(getContext())
                    .load(imageUrl)
                    .fit()
                    .into(imageView);

Using transform you can crop the image based on the gravity.

Picasso.with(mContext)
       .load(imageUrl)
       .transform(new CropTransformation(500,150),  CropTransformation.GravityHorizontal.CENTER, CropTransformation.GravityVertical.TOP))
       .into(imageView);

The above code will cut the image from the bottom only.

You can get CropTransformation library here .

Try this .centerCrop(Gravity.TOP)

   Picasso.get()
                .load(GlobalApplication.BaseUrl +"/" + item.AD_THUMBNAIL)
                .resize(180, 145)
                .centerCrop(Gravity.TOP)
                .into(holder.imgAd);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM