Is it possible to apply the adjustViewBounds function after match_parent in the Glide library?

Asked 2 years ago, Updated 2 years ago, 23 views

Hello, how are you?

I'm a beginner who's been doing a little bit of work... I'll give you one ㅠ<

This time, I'm printing an image using the Glide library Previously, when you want to fill the image horizontally and show the image of the original ratio

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

I used it in the same format as above. However, when I put the image using Glide in that state, it was printed differently from the original ratio Is it possible to give match_parent horizontally to Glide and vertical flexibly to each machine according to the original ratio?

android java

2022-09-21 21:30

1 Answers

PercentFrameLayout is located within the Android support library.

I think you can use it as below.

 <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>


2022-09-21 21:30

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.