您好我正在使用Edmodo Cropper Library,如果在纵向和横向之间切换,则会遇到布局问题。从风景看,一切看起来都很好(见前2图片)。
但是当我从风景开始并切换到肖像时,图像不会缩小,只有一半可见,这也适用于裁剪矩形(参见最后2张图片)。
只有一个XML布局但行为不同?
继承我的布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/black">
<com.theartofdev.edmodo.cropper.CropImageView
android:id="@+id/CropImageView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:scaleType="fitCenter"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:baselineAligned="true">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="40dp"
android:id="@+id/imageButton"
android:layout_gravity="left|bottom"
android:src="@drawable/times"
android:scaleType="fitCenter"
android:background="@null"
android:adjustViewBounds="false"
android:onClick="cancelImageSelection"
android:paddingBottom="10dp"
android:layout_weight="1" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="40dp"
android:id="@+id/imageButton3"
android:layout_gravity="bottom|right"
android:src="@drawable/check"
android:scaleType="fitCenter"
android:background="@null"
android:adjustViewBounds="false"
android:onClick="gimmeImageForPoll"
android:paddingBottom="10dp"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
MY Manifest声明:
<activity
android:name=".activity.CropperActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/title_activity_cropper"
android:theme="@style/FullscreenTheme" />
最后我的Cropper活动的onCreate():
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cropper);
//dont show statusbar
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
ActionBar actionBar = getSupportActionBar();
actionBar.hide();
mContentView = findViewById(R.id.CropImageView);
mCropImageView = (CropImageView) findViewById(R.id.CropImageView);
Intent incomingData = getIntent();
imageURI = Uri.parse(incomingData.getExtras().getString("imageURI"));
mCropImageView.setImageUri(imageURI);
//we need a quadrat for our PICs
mCropImageView.setFixedAspectRatio(true);
mCropImageView.setAspectRatio(1,1);
}
任何人都有一个想法,这种奇怪的行为来自哪里?