2017-11-22 18 views
1

"centerCrop"또는 "center"를 시도하면 이미지 뷰가 변경되지 않습니다. 이미지를자를 수 있도록 해결해야 할 문제는 무엇입니까? 내 코드를 참조이미지 뷰 자르기가 작동하지 않습니다.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     xmlns:tools="http://schemas.android.com/tools" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     tools:context="xx.myapplication.MainActivity"> 

     <ImageView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@drawable/party" 
      android:scaleType="centerCrop" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="From. h" 
       android:layout_alignParentRight="true" 
       android:layout_alignParentBottom="true" 
       android:layout_margin="8dp" 
       android:padding="8dp" 
       android:textSize="20sp" 
       android:textColor="#FFEBEE" 
       android:fontFamily="sans-serif-medium" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Happy Wednesday!!" 
       app:layout_constraintBottom_toBottomOf="parent" 
       app:layout_constraintLeft_toLeftOf="parent" 
       app:layout_constraintRight_toRightOf="parent" 
       app:layout_constraintTop_toTopOf="parent" 
       android:layout_margin="8dp" 
       android:textSize="36sp" 
       android:textColor="@android:color/white"/> 

    </RelativeLayout> 

이미지 :

Image that I see with my code now is here<<

+0

항상 인라인 이미지의 "!" 다른 사람이 링크를 열지 않고도 이미지를 볼 수 있도록 이미지 링크 앞에 표시합니다. – EvilTak

+0

@EvilTak 내가 "!" 이미지 링크 전에 시청자에게 클릭하도록 요청하는 대신이 페이지에 직접 이미지가 표시됩니다. – learningcur

+0

예. 내 [편집] (https://stackoverflow.com/posts/47440001/revisions)을보십시오. – EvilTak

답변

1

사용 src 대신 접두사에 의해 background

android:src="@drawable/party" 
-1

정말 당신이 당신의 자바 파일에 가난한 이미지 뷰에 일을 할 수있는 것을 보지 않고 도울 수 없어요. 하지만 다음 당신이 일을 시도 할 수있는 생각 : 당신의 프로그램이 응용 프로그램 또는 제거 (항상하지 않음) 재미있는

  • 을 취소하면

    1. 가 현금화을 무효화 안드로이드 스튜디오를 다시 시작, 항상 이렇게 그것은 당신의 테스트 장치 또는 에뮬레이터에서, 때로는 즉시 빌드 때문일 수 있습니다.