2017-04-03 1 views
0

TouchImageView를 사용하여 사진을 확대/축소합니다. 그러나 TouchImageView.java를 추가하고 xml에서 customview를 생성 한 후에는 표시되지 않았습니다.TouchImageView가 xml에 표시되지 않습니다.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:orientation="vertical" android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@color/cast_expanded_controller_background_color" 
android:id="@+id/Rlay"> 

<com.example.zhen.myggwpapp.TouchImageView 
    android:layout_height="350dp" 
    android:id="@+id/iv_preview_image" 
    android:layout_width="match_parent" 
    android:scaleType="matrix" 
    android:layout_centerVertical="true" 
    android:layout_alignParentStart="true" /></RelativeLayout> 

TouchImageView in xml showing only blue dot

답변

1

시도가 ImageView 내부 android:src:@drawable/some_image를 추가하거나 그것의 폭과 높이를 볼 수있는 몇 가지 배경을 추가 : 다음은 내 XML 파일입니다. android:background="@color/some_color "

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     android:orientation="vertical" android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@color/color_white" 
     android:id="@+id/Rlay"> 

     <com.example.zhen.myggwpapp.TouchImageView 
      android:layout_height="350dp" 
      android:background="@color/color_black" 
      android:id="@+id/iv_preview_image" 
      android:src="@drawable/some_image" 
      android:layout_width="match_parent" 
      android:scaleType="matrix" 
      android:layout_centerVertical="true" 
      android:layout_alignParentStart="true" /> 

    </RelativeLayout> 
+0

감사합니다! –

관련 문제