我正在使用Picasso库加载图像并且其工作正常但在使用此库图像后不适合布局.如果我将图像直接设置到图像视图,那么图像将适合布局.是否有任何传递方法的选项在毕加索,以适应图像布局
Picasso.with(getContext())
.load(R.drawable.dddd).
.into(lavdateimageView);
Run Code Online (Sandbox Code Playgroud)
即使我试图通过以下方法,但没有用
ImageView,fit()等
XML文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
android:background="#ffffff"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#ffffff"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="260dp"
android:layout_marginBottom="3dp"
android:id="@+id/lavdate_image"
android:orientation="vertical"
>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/lavdateimageView" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Text to"
android:padding="3dp"
android:background="#ffffff"
android:textColor="#000000"
android:layout_margin="3dp"
android:textStyle="bold"
android:id="@+id/sss" />
</LinearLayout>
</ScrollView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
Han*_*ala 13
我也有同样的问题,所以我尝试了它工作正常
Picasso.get()
.load(IMAGE_URL)
.fit()
.centerCrop()
.into(imageView);
Run Code Online (Sandbox Code Playgroud)
是的,最后我理解了我的错误.我用过 android:scaleType="centerCrop",现在我的形象适合布局
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:id="@+id/myimageView" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7894 次 |
| 最近记录: |