0

存在一個包含大量矢量圖像的對話框。如何計算任何屏幕的每張圖片的大小?RecyclerView中的ImageViews(帶有VectorDrawables)的大小

enter image description here

如果我使用

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

我得到這個結果

enter image description here

,但我需要自動設置大小imageviews。怎麼樣?

回答

0

爲了獲得垂直滾動RecyclerView相同的最大尺寸的所有VectorDrawables,你需要在根元素

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

我想水平滾動條參數的值應該被逆轉XML安裝。

相關問題