마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

ImageView ScaleType 관련 질문 입니다.ㅠㅠ도와주세요.ㅠㅠ

0 추천

여러개의 imageview를 넣어서 화면을 구성 하는 중입니다.

imageView 에 표시될 이미지가 imageview 보다 큰것도 있고 작은것도 있어서

imageview의 틀에 맞게 이미지를 확대해서 중간을 보여주기 위해서 scaleType의

center_Crop 옵션을 주었습니다. 그런데 이미지가 큰경우에는 imageView 가 이미지와 함께 늘어 납니다..ㅠㅠ

화면 구성은 weight 로 구성하였습니다. 부모 레이아웃에 height의 값을 주어도 imageView

가 늘어 납니다 ㅠㅠ scaleType 을 fitXY로 지정해도 imageView의 크기가 늘어납니다 ㅠㅠ

imageView가 안늘어나고 center_crop 옵션이 적용 되게 하려면 어떻게 해야 되나요??ㅠㅠㅠ

고수님들 도와주세요 ㅠㅠ

ImageView imv = (ImageView) convertView
      .findViewById(resourceID[i]);
    imv.setScaleType(ScaleType.CENTER_CROP);
    imageLoad.setImageView(imv);

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    android:orientation="vertical"
    android:paddingLeft="6dip"
    android:paddingRight="6dip"
    android:weightSum="10" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="3"
        android:orientation="vertical"
        android:paddingBottom="6dip"
        android:paddingTop="3dip" >

        <ImageView
            android:id="@+id/image_pattern01"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:src="@drawable/icon" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="4.5"
        android:orientation="horizontal"
        android:paddingBottom="6dip"
        android:weightSum="10" >

        <LinearLayout
            android:layout_width="0dip"
            android:layout_height="match_parent"
            android:layout_weight="5"
            android:orientation="vertical"
            android:paddingRight="3dip"
            android:weightSum="10" >

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0dip"
                android:layout_weight="2"
                android:orientation="horizontal"
                android:paddingBottom="6dip"
                android:weightSum="10" >

                <LinearLayout
                    android:layout_width="0dip"
                    android:layout_height="match_parent"
                    android:layout_weight="5"
                    android:paddingRight="3dip" >

                    <ImageView
                        android:id="@+id/image_pattern02"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:src="@drawable/icon" />
                </LinearLayout>

망나니 (140 포인트) 님이 2013년 5월 10일 질문
망나니님이 2013년 5월 10일 수정

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...