naver / android-imagecropview

android image crop library
Apache License 2.0
254 stars 55 forks source link

The crop box is not in the center of the view #58

Open mafanwei opened 3 years ago

mafanwei commented 3 years ago

When I fix view's width or height: <com.naver.android.helloyako.imagecrop.view.ImageCropView xmlns:imagecrop="http://schemas.android.com/apk/res-auto" android:layout_width="200dp" android:layout_height="200dp" imagecrop:layout_constraintBottom_toTopOf="@id/cl_title" imagecrop:layout_constraintLeft_toLeftOf="parent" imagecrop:layout_constraintRight_toRightOf="parent" imagecrop:layout_constraintTop_toTopOf="parent" android:id="@+id/cropIV" imagecrop:outsideLayerColor="#99000000" imagecrop:setInnerGridMode="on" imagecrop:gridInnerStroke="1dp" imagecrop:gridInnerColor="#FFFFB246" imagecrop:setOuterGridMode="on" imagecrop:gridOuterStroke="1dp" imagecrop:gridOuterColor="#FFFFB246" /> The Image is: image When I use this: <com.naver.android.helloyako.imagecrop.view.ImageCropView xmlns:imagecrop="http://schemas.android.com/apk/res-auto" android:layout_width="300dp" android:layout_height="200dp" imagecrop:layout_constraintBottom_toTopOf="@id/cl_title" imagecrop:layout_constraintLeft_toLeftOf="parent" imagecrop:layout_constraintRight_toRightOf="parent" imagecrop:layout_constraintTop_toTopOf="parent" android:id="@+id/cropIV" imagecrop:outsideLayerColor="#99000000" imagecrop:setInnerGridMode="on" imagecrop:gridInnerStroke="1dp" imagecrop:gridInnerColor="#FFFFB246" imagecrop:setOuterGridMode="on" imagecrop:gridOuterStroke="1dp" imagecrop:gridOuterColor="#FFFFB246" /> The Image is: image Only Use this: <com.naver.android.helloyako.imagecrop.view.ImageCropView xmlns:imagecrop="http://schemas.android.com/apk/res-auto" android:layout_width="0dp" android:layout_height="0dp" imagecrop:layout_constraintBottom_toTopOf="@id/cl_title" imagecrop:layout_constraintLeft_toLeftOf="parent" imagecrop:layout_constraintRight_toRightOf="parent" imagecrop:layout_constraintTop_toTopOf="parent" android:id="@+id/cropIV" imagecrop:outsideLayerColor="#99000000" imagecrop:setInnerGridMode="on" imagecrop:gridInnerStroke="1dp" imagecrop:gridInnerColor="#FFFFB246" imagecrop:setOuterGridMode="on" imagecrop:gridOuterStroke="1dp" imagecrop:gridOuterColor="#FFFFB246" /> It's fine: image

It's seem to something wrong in onMeasure.

mafanwei commented 3 years ago

I Only change width and height.