2017-04-07 1 views
-2

을 확장 할 수 없습니다 ImageView가 가져 오기되지 않은 것으로 표시되면 ...안드로이드 단순히 이미지 뷰를 확장하려는 이미지 뷰

여기서 내가 뭘 잘못하고 있니? 당신이 다음 AppCompatImageView을 가져올 때

+0

'extends'부분도 변경해야합니다. public 클래스 SquareImageView는 AppCompatImageView를 확장한다. –

+0

'SquareImageView extneds android.support.v7.widget.AppCompatImageView' –

답변

4

이 완벽하게 잘 작동이

import android.content.Context; 
import android.support.v7.widget.AppCompatImageView; 
import android.util.AttributeSet; 

public class CustomImageView extends AppCompatImageView { 
    public CustomImageView(Context context) { 
     super(context); 
    } 

    public CustomImageView(Context context, AttributeSet attrs) { 
     super(context, attrs); 
    } 

    public CustomImageView(Context context, AttributeSet attrs, int defStyleAttr) { 
     super(context, attrs, defStyleAttr); 
    } 
} 

당신도 그것을 사용해야합니다. 뿐만 아니라이, JAVA에서, 이 무엇을 가져올 것은 당신이 그것을 다른 방법을 use.putting 것입니다, 당신은 당신이 AppCompat 위젯을 사용

1

를 사용하려면 무엇을 가져 당신이 사전 롤리팝 버전과 장치에서 일부 기능을 가질 수 있습니다 기계적 인조 인간.

AppCompatImageView, ImageView을 사용할 수 있습니다.

관련 문제