2016-06-16 5 views
0

RelativeLayout 안에 ImageView를 놓아야합니다. 다음과 같이하십시오.LinearLayout 또는 RelativeLayout의 크기를 조정 한 후 이미지의 크기를 조정하십시오.

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"> 
    <ImageView 
      android:id="@+id/imagen" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:scaleType="centerInside" 
      android:src="@drawable/image1"/> 
</RelativeLayout> 

이 이미지는 장치 화면에 비해 너무 크기 때문에 일부 장치에서는 크기가 조정됩니다. 크기가 조정 된 나머지 레이아웃은 this과 비슷합니다. 이미지 주위에 회색 영역이 있음을 알 수 있습니다. 원래 크기 조정은 원래의 RelativeLayout입니다.

어떻게 남은 공간을 제거 할 수 있습니까? 감사!

+0

당신은 내가 이미지 뷰의 컨테이너 크기를 조정하려는 피카소 라이브러리 – ashishmohite

+0

를 사용하여 그림 크기를 조정할 수없는 이미지 자체! 제발, 내가 업로드 한 이미지를 보아라. –

+0

여기에서 같은 문제가있다, 그것이 당신을 위해 일하는 지 알기 위해 http://stackoverflow.com/questions/15425151/change-relative-layout-width-and-height-dynamically – Raskayu

답변

0

는 시도이

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    <ImageView 
      android:id="@+id/imagen" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:scaleType="centerCrop" 
      android:src="@drawable/image1"/> 
</RelativeLayout> 
+0

이것은 작동하지 않는다, 이미지는 이제 모든 공간을 uccupes! –

관련 문제