안녕하세요.

 

 

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/color_gray" >

        <ImageView
            android:id="@+id/mainImage"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:adjustViewBounds="true"
            android:background="@null"
            android:scaleType="centerCrop" />
    </RelativeLayout>

 

 

XML 로는 위처럼 선언이 되었구요......

 

이미지뷰 사이즈를 바꿔야 해서

 

ImageView imgView = (ImageView).findViewById(R.id.mainImage);

imgView.setLayoutParams(new RelativeLayout.LayoutParams(500, 300));

 

위처럼 사이즈를 변경하였더니

 

XML의 android:layout_centerInParent="true" 적용이 안되네요.....

 

자바소스로 위의 가운데 정렬을 처리하고 싶습니다.

 

좋은하루 되시구요, 답변 부탁 드리겠습니다.

 

감사합니다.