【问题标题】:Size of ImageViews (with VectorDrawables) in RecyclerViewRecyclerView 中 ImageView 的大小(带有 VectorDrawables)
【发布时间】:2017-08-10 16:14:51
【问题描述】:

有一个包含很多矢量图像的对话框。如何计算任意屏幕每张图片的大小?

如果我使用

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

我得到了这个结果

但我需要自动设置图像视图的大小。怎么样?

【问题讨论】:

    标签: java android android-recyclerview android-vectordrawable


    【解决方案1】:

    为了在Vertical Scrolling RecyclerView中获得相同最大尺寸的所有VectorDrawables,需要在根元素的xml中安装

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

    我想对于水平滚动,参数的值应该颠倒。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-19
      • 2016-08-12
      • 2018-08-30
      • 2021-04-11
      • 2016-08-28
      • 1970-01-01
      相关资源
      最近更新 更多