我有一個活動,必須在其中顯示一個圖像以縮放到縮放功能,並且我需要關閉將其拖動到Facebook應用時發生的活動。我使用Chris Banes的PhotoView進行圖像縮放,使用SwipeBack通過拖放關閉活動。這裏是我的活動:使用SwipeBack不能正常工作的PhotoView(用於縮放)
public class AlternateFullImageActivity extends SwipeBackActivity {
String photoId;
String token;
TinyDB tinyDB;
RestAdapter restAdapter;
@Bind(R.id.zoomable)
ImageView image;
@Bind(R.id.swipe_layout)
SwipeBackLayout swipeBackLayout;
PhotoViewAttacher mAttacher;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_alternate_full_image);
setDragEdge(SwipeBackLayout.DragEdge.TOP);
ButterKnife.bind(this);
tinyDB = new TinyDB(this);
token = tinyDB.getString("Galleri5 Access Token");
Intent intent = getIntent();
photoId = intent.getExtras().getString("ID");
RequestInterceptor requestInterceptor = new RequestInterceptor() {
@Override
public void intercept(RequestFacade request) {
request.addHeader("Accept", "application/json");
request.addHeader("Authorization", "Token " + token);
}
};
OkHttpClient okHttpClient = new OkHttpClient();
restAdapter = new RestAdapter.Builder()
.setClient(new OkClient(okHttpClient))
.setLogLevel(RestAdapter.LogLevel.FULL)
.setEndpoint(API)
.setRequestInterceptor(requestInterceptor)
.build();
PhotoAPI photoAPI = restAdapter.create(PhotoAPI.class);
photoAPI.getFeed(photoId, new Callback<ImageItem>() {
@Override
public void success(ImageItem imageItem, Response response) {
Picasso.with(AlternateFullImageActivity.this)
.load(imageItem.getPhotoUrl())
.into(image);
mAttacher = new PhotoViewAttacher(image);
}
@Override
public void failure(RetrofitError error) {
}
});
}
}
這裏是我的佈局文件:
<com.liuguangqiang.swipeback.SwipeBackLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/swipe_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.galleri5.android.activities.AlternateFullImageActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000">
<uk.co.senab.photoview.PhotoView
android:id="@+id/zoomable"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true" />
</RelativeLayout>
</com.liuguangqiang.swipeback.SwipeBackLayout>
當我運行它,一切工作正常,但只要我縮小圖像,我得到這個錯誤:
11-05 14:23:37.125 3506-3506/com.galleri5.android E/InputEventReceiver: Exception dispatching input event.
11-05 14:23:37.126 3506-3506/com.galleri5.android E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.support.v4.widget.ViewDragHelper.shouldInterceptTouchEvent(ViewDragHelper.java:1014)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at com.liuguangqiang.swipeback.SwipeBackLayout.onInterceptTouchEvent(SwipeBackLayout.java:248)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2059)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2569)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1743)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.app.Activity.dispatchTouchEvent(Activity.java:2739)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.support.v7.internal.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2530)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.View.dispatchPointerEvent(View.java:8578)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4028)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3894)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3456)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3509)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3475)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3585)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3483)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3642)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3456)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3509)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3475)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3483)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3456)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5708)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5682)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5653)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5798)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.os.MessageQueue.nativePollOnce(Native Method)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.os.MessageQueue.next(MessageQueue.java:143)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.os.Looper.loop(Looper.java:122)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at android.app.ActivityThread.main(ActivityThread.java:5254)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at java.lang.reflect.Method.invoke(Native Method)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at java.lang.reflect.Method.invoke(Method.java:372)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
11-05 14:23:37.130 3506-3506/com.galleri5.android E/MessageQueue-JNI: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: FATAL EXCEPTION: main
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: Process: com.galleri5.android, PID: 3506
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.support.v4.widget.ViewDragHelper.shouldInterceptTouchEvent(ViewDragHelper.java:1014)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at com.liuguangqiang.swipeback.SwipeBackLayout.onInterceptTouchEvent(SwipeBackLayout.java:248)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2059)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2569)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1743)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.app.Activity.dispatchTouchEvent(Activity.java:2739)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.support.v7.internal.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2530)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.View.dispatchPointerEvent(View.java:8578)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4028)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3894)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3456)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3509)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3475)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3585)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3483)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3642)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3456)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3509)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3475)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3483)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3456)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5708)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5682)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5653)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5798)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.os.MessageQueue.nativePollOnce(Native Method)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.os.MessageQueue.next(MessageQueue.java:143)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.os.Looper.loop(Looper.java:122)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5254)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
11-05 14:23:37.172 3506-3506/com.galleri5.android E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
之後,我讀了PhotoView,並按照github頁面的指示,我嘗試爲SwipeBackLayout創建一個Hacky Layout。這是代碼:
import com.liuguangqiang.swipeback.SwipeBackLayout;
public class HackySwipeBackLayout extends SwipeBackLayout {
public HackySwipeBackLayout(Context context) {
super(context);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
try {
return super.onInterceptTouchEvent(ev);
} catch (IllegalArgumentException e) {
e.printStackTrace();
return false;
}
}
}
然後,我用新的HackySwipebackLayout替換了早期的佈局文件。
但在那之後,當我運行應用程序,然後在圖像上到上面去活動,我得到這個錯誤:
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: FATAL EXCEPTION: main
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: Process: com.galleri5.android, PID: 6709
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.galleri5.android/com.galleri5.android.activities.AlternateFullImageActivity}: android.view.InflateException: Binary XML file line #3: Error inflating class com.galleri5.android.utils.HackySwipeBackLayout
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2329)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2389)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.app.ActivityThread.access$900(ActivityThread.java:147)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1296)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.os.Looper.loop(Looper.java:135)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5254)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #3: Error inflating class com.galleri5.android.utils.HackySwipeBackLayout
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.view.LayoutInflater.createView(LayoutInflater.java:616)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:482)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at com.liuguangqiang.swipeback.SwipeBackActivity.setContentView(SwipeBackActivity.java:21)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at com.galleri5.android.activities.AlternateFullImageActivity.onCreate(AlternateFullImageActivity.java:48)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:5933)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2282)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2389)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.app.ActivityThread.access$900(ActivityThread.java:147)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1296)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.os.Looper.loop(Looper.java:135)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5254)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet]
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at java.lang.Class.getConstructor(Class.java:531)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at java.lang.Class.getConstructor(Class.java:495)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.view.LayoutInflater.createView(LayoutInflater.java:580)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:482)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at com.liuguangqiang.swipeback.SwipeBackActivity.setContentView(SwipeBackActivity.java:21)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at com.galleri5.android.activities.AlternateFullImageActivity.onCreate(AlternateFullImageActivity.java:48)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:5933)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2282)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2389)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.app.ActivityThread.access$900(ActivityThread.java:147)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1296)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.os.Looper.loop(Looper.java:135)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5254)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
11-05 14:28:22.245 6709-6709/com.galleri5.android E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
有什麼能爲這個怎麼可能的原因,使其工作?我真的需要它的工作。謝謝。
我改變了我的HackySwipeBackLayout,至少現在它顯示圖像,但即使現在,如果現在我縮小圖像太多,我得到了我寫在問題中的第一個錯誤。 –
那麼,這是有道理的,因爲'HackySwipeBackLayout'只是試圖捕捉'IllegalArgumentException'。在你的情況下,拋出一個'ArrayIndexOutOfBoundsException',這是一個完全不同的錯誤,因此沒有被捕獲/處理。你可以嘗試添加一個catch分支,但我不敢說這是否會「修復」你看到的問題...... –
那麼這意味着錯誤在SwipeBack Library中?有什麼類似的圖書館你知道我可以使用? –