Glide 라이브러리에서 match_parent 후 adjustViewBounds 기능 적용이 가능할까요?

조회수 1440회

안녕하세요?

이제 막 실무를 쪼금씩 하고 있는 초보인데... 하나만 드리겠습니다 ㅠㅠ

이번에 Glide 라이브러리를 사용해서 이미지를 출력하고있는데요, 기존에는 이미지를 가로를 꽉차게 하고 원본비율의 이미지를 보여주고싶을때

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"

위와 같은 형식으로 사용을 했었습니다. 그런데 저 상태에서 Glide를 사용하여 이미지를 넣으니 원본비율과는 다르게 출력이 되더라구요, 혹시 Glide로 가로는 match_parent, 세로는 원본비율에 따라 기계마다 유동적으로 줄수는 없을까요??

  • (•́ ✖ •̀)
    알 수 없는 사용자

1 답변

  • 안드로이드 support library 내에 PercentFrameLayout이 있습니다.

    그걸 아래와 같이 이용하시면 될 것 같습니다.

     <android.support.percent.PercentFrameLayout
         xmlns:android="http://schemas.android.com/apk/res/android"
         xmlns:app="http://schemas.android.com/apk/res-auto"
         android:layout_width="match_parent"
         android:layout_height="match_parent">
         <ImageView
             app:layout_widthPercent="50%"
             app:layout_heightPercent="50%"
             app:layout_marginTopPercent="25%"
             app:layout_marginLeftPercent="25%"/>
     </android.support.percent.PercentFrameLayout>
    
    • (•́ ✖ •̀)
      알 수 없는 사용자
    • 답변 감사합니다, 근데 지금 환경에서 사용을 못하네요 ㅠㅠ target,compile,min SDK버전이 16 이라서요 ㅠㅠ 알 수 없는 사용자 2017.9.25 21:41

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)