Android picasso scale photos to be bigger or fit the imageView (no white space) -


i have serious problem picasso library scaling. problem have layout consisting of 3 main views , buttons. views :

imageview 50% mapview 20% edittextview 30%

and want load pictures of unknown resolution imageview without leaving white spaces. trying use .fit().centerinside left white spaces on sides. how layout looks like:

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">     <linearlayout         android:layout_width="match_parent"         android:layout_height="match_parent"         android:orientation="vertical"         android:layout_below="@+id/photo1"         android:weightsum="10">          <imageview         android:id="@+id/photo1"         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="5"         android:background="#75aea7ab" />          <com.google.android.gms.maps.mapview             android:id="@+id/map2"             android:layout_width="fill_parent"             android:layout_height="0dp"             android:layout_weight="2" />          <edittext             android:id="@+id/edittext"             android:layout_width="fill_parent"             android:layout_height="0dp"             android:layout_marginbottom="15dp"             android:layout_marginleft="15dp"             android:layout_marginright="15dp"             android:layout_margintop="15dp"             android:layout_weight="3"             android:background="#00000000"             android:gravity="top|left"             android:inputtype="textmultiline"             android:textcolor="#ff000000"             android:textsize="15sp" />     </linearlayout> <imagebutton     android:id="@+id/post"     android:layout_width="@dimen/fab_button_diameter"     android:layout_height="@dimen/fab_button_diameter"     android:layout_alignparentbottom="true"     android:layout_alignparentend="true"     android:layout_alignparentright="true"     android:layout_gravity="end"     android:layout_marginbottom="300dp"     android:background="@drawable/fab_shape"     android:src="@drawable/forward"     android:text="post!"     android:tint="@android:color/white" />  <button     android:id="@+id/camera"     android:layout_width="72dp"     android:layout_height="72dp"     android:layout_alignparentleft="true"     android:layout_alignparentstart="true"     android:layout_alignparenttop="true"     android:layout_marginleft="75dp"     android:layout_margintop="100dp"     android:background="@drawable/camera" />  <button     android:id="@+id/gallery"     android:layout_width="72dp"     android:layout_height="72dp"     android:layout_alignparentend="true"     android:layout_alignparentright="true"     android:layout_alignparenttop="true"     android:layout_marginright="75dp"     android:layout_margintop="100dp"     android:background="@drawable/gallery" /> 

have try set scaletype after image has been loaded?

   mpicasso.load("yoururl")                     .into(yourimageview, new callback() {                         @override                         public void onsuccess() {                             yourimageview.setscaletype(imageview.scaletype.center_crop);//or scaletype.fit_center                         }                         @override                         public void onerror() {                             //nothing                         }                     }); 

Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -