0

Il y a un dialogue avec beaucoup d'images vectorielles. Comment calculer la taille de chaque image pour n'importe quel écran?Taille d'ImageViews (avec VectorDrawables) dans RecyclerView

enter image description here

Si j'utilise

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/ava_item" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"> 

    <ImageView 
     android:id="@+id/ava_item_imageview" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerInParent="true" 
     android:adjustViewBounds="true"/> 
</FrameLayout> 

i obtenir ce résultat

enter image description here

Mais j'ai besoin de taille automatiquement définis pour imageviews. Comment?

Répondre

0

Afin d'obtenir tous les VectorDrawables de la même taille maximale à la verticale Scrolling RecyclerView, vous devez installer en XML à l'élément racine

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

Je suppose que pour un défilement horizontal, les valeurs des paramètres doivent être inversés .