2012-06-14 3 views
1

CropImageView이라는 클래스가 ImageView에서 확장되었습니다. 그러나 문은 아래 castException 수 :사용자 정의 확장보기보기 찾기

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 

    <RelativeLayout 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:orientation="horizontal"> 

     <ImageView android:id="@+id/image" 
       android:background="#55000000" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:layout_x="0dip" 
       android:layout_y="0dip"/> 
    </RelativeLayout> 
    </FrameLayout> 

당신이 어떤 제안이 있습니까 :

여기
CropImageView image = (CropImageView) findViewById(R.id.image); 

XML 파일입니까?

답변

1

XMLCropImageView 정식 이름을 사용해야합니다. 다음과 같음 :

<your.package.CropImageView 
    android:id="@+id/image" 
    android:background="#55000000" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_x="0dip" 
    android:layout_y="0dip"/> 
1

레이아웃에 <ImageView /> 대신 <com.your.package.CropImageView />을 사용해보세요.