2014-04-15 5 views
1

ImageView를 사용하는 간단한 애플리케이션이 있습니다.Android ImageView 가로 - 세로

이미지가 너비가 맞지 않으면 스크롤해야합니다.

<ScrollView 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="wrap_content" > 

    <ImageView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:adjustViewBounds="true" 
     android:scaleType="center" 
     android:id="@+id/myPic" 
     android:contentDescription="@string/page_label" /> 
</RelativeLayout> 

모든 것이 완벽,하지만 난 못해 모든 폭을 가로 이미지로 전환 할 때, 빈 공간 (왼쪽, 오른쪽)가있다.

ImageView.ScaleType CENTER_CROP 만 도움이되지만 위와 아래의 부분을 잘라냅니다. 가로로 같은 방식으로 작동하도록 할 수 있습니까?

+0

ScrollView에 android : fillViewPort = "true"를 추가하십시오. –

+0

'android'패키지의 'fillViewPort'속성에 대한 리소스 식별자가 없습니다. – user3536513

+0

http://developer.android.com/reference/android/widget/ScrollView.html –

답변

0

scaletype fitCenter ImageView 용으로 트릭을 수행합니다. 사진을 최대 너비로 조정하고 가로 세로 비율을 유지하면서 높이를 스크롤 할 수 있습니다.