當這裏是我的logcat錯誤:Android應用程序強制關閉改變縱向到橫向
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jc.jcpremiere/com.jc.jcpremiere.activity2}: java.lang.IllegalArgumentException: Wrong state class, expecting View State but received class android.os.Bundle instead. This usually happens when two views of different type have the same id in the same hierarchy. This view's id is id/aboutview. Make sure other views do not use the same id.
我得到這個每當我轉我的手機從人像到風景。我的/layout
和/layout-land
的佈局只包含一個顯示圖像的視圖,但在縱向上,它可以被捏和放大,並且位於centerInside
之間,在橫向上它是fitxy
。
這裏是我的肖像
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rellayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.jc.jcpremiere.TouchImageView
android:id="@+id/aboutview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:adjustViewBounds="true"
android:background="@color/White"
android:scaleType="centerInside" />
</RelativeLayout>
而對於我的風景
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativelayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<ImageView
android:id="@+id/aboutview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/White"
android:scaleType="fitXY" />
</RelativeLayout>
有沒有一種方法,我可以只使用imageview的景觀和適合xy和肖像我可以使用touchimageview中心裏面? – user3334111 2014-09-11 02:33:35