如何使用clickableAreaImages库将imageview显示为全屏

时间:2018-09-21 06:50:54

标签: android android-activity imageview scaletype clickable-image

我正在使用ClickableAreasImages库,同时从url加载图像时遇到了问题。

图片未全屏显示。

获取此output output

布局

<RelativeLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:fitsSystemWindows="true"
   android:gravity="center"
   tools:context=".MainActivity">

   <ImageView
        android:id="@+id/imageView"
        android:adjustViewBounds="true"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="fitCenter"
        android:layout_centerVertical="true"/>
</RelativeLayout>

Java

    image = (ImageView) findViewById(R.id.imageView);

    Glide.with(mContext)
            .load(Uri.parse("https://www.mcdonaldjoneshomes.com.au/sites/default/files/floorplans/images/hermitage-standard-lhs-2546x1900_0.png"))
            .apply(new RequestOptions().placeholder(R.drawable.site1).error(R.drawable.site1).fitCenter())
            .into(image);

    image.setImageResource(R.drawable.firstandsecondfloorplan);

     ClickableAreasImage clickableAreasImage = new ClickableAreasImage(new PhotoViewAttacher(image), this);

        // Define your clickable area (pixel values: x coordinate, y coordinate, width, height) and assign an object to it
        List<ClickableArea> clickableAreas = getClickableAreas();
        clickableAreasImage.setClickableAreas(clickableAreas);

我正在使用

//glide
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'

任何建议将不胜感激

0 个答案:

没有答案