【发布时间】:2018-08-02 19:04:02
【问题描述】:
我知道这类问题一直存在,但我有一个具体问题..
我正在使用glide library 将我的sqlite database 中的图像路径转换为imageviewin myexpendablelistview..我使用photoview library 使它们可缩放..问题是imageviw 的大小确定加载图像的质量..让我解释一下:
如果图像视图很大,则加载的图像很大并且在缩放中看起来不错。但是如果图像视图很小(比如说图标)..那么加载的质量很差,缩放时看起来很糟糕。
我想制作一个小的图像视图,但点击后可以获得高质量的可缩放图像
这是我的代码:
case R.id.child3 :
ImageView url = (ImageView) view;
String urls;
urls = cursor.getString(cursor.getColumnIndex(Database.DATABASE_CHILD_3));
Glide.with(MainActivity.this).load(urls).into(url);
url.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AlertDialog.Builder mBuilder = new AlertDialog.Builder(MainActivity.this);
View mView = getLayoutInflater().inflate(R.layout.dialog_custom_layout, null);
PhotoView photoView = mView.findViewById(R.id.imageView);
photoView.setImageDrawable(((ImageView)view).getDrawable());
mBuilder.setView(mView);
AlertDialog mDialog = mBuilder.create();
mDialog.show();
}
});
break;
我的 list_child.xml
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:id="@+id/child3"
android:layout_centerHorizontal="true"
Dialog_custom_layout.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:orientation="vertical"
>
<com.github.chrisbanes.photoview.PhotoView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
/>
</LinearLayout>
【问题讨论】:
-
通过添加 noTransformation 解决!
标签: android