2014-09-11 2 views
0

에 초상화를 변경할 때 여기 내 로그 캣 오류의 닫습니다. /layout/layout-land에 대한 레이아웃은 이미지를 표시하기위한보기 만 포함하고 있지만 세로 방향에서는 집어 넣고 확대하여 centerInside에 있고 가로로 보면 fitxy입니다.안드로이드 응용 프로그램의 힘은 풍경

다음은 모두 당신의 com.jc.jcpremiere.TouchImageViewImageView 클래스 android:id="@+id/aboutview"이 세로

<?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> 

답변

1

당신의 imageview의 유형이 potrait에서 landscape 모드로 변경 중입니다. Potrait는 ImageView을 사용하며 가로는 TouchImageView을 사용합니다. 따라서 findViewById() 메서드는 가로 모드에서 잘못된 뷰 객체를 참조합니다. Java 클래스에서 imageView의 객체를 TouchImageView로 변경해보십시오. 그러면 potrait 모드가 중단 될 것입니다.

+0

가로 모드에서 이미지 뷰를 사용할 수있는 방법이 있고 xy에 맞춰 찍을 수있는 방법이 있나요? 내부에 touchimageview를 사용할 수 있습니까? – user3334111

1

내 레이아웃입니다.

android:id은 고유해야하며 두 구성 요소가 동일한 Android ID를 가질 수 없습니다. Android ID를 다른 것으로 변경하면 문제가 해결됩니다.

또한 세로 모드와 가로 모드 모두 TouchImageView 또는이어야합니다. 각 모드별로 다른 유형의보기 구성 요소는 없습니다.

관련 문제