美文网首页
Android自定义View实现商城商品详情图片列表

Android自定义View实现商城商品详情图片列表

作者: itfitness | 来源:发表于2020-07-12 11:15 被阅读0次

目录

目录

前言

由于最近做了好几个需要类似商城展示商品详情的列表效果,所以索性就封装了一个通用版的控件,只需要简单的几行代码就能实现所需效果。

效果展示

实现原理

其实实现原理很简单,就算自己用listView或者RecyclerView也能实现。在Item布局中只需要使用一个ImageView即可,宽度填充父元素,高度自适应,拉伸类型为fitXY。

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <ImageView
        android:id="@+id/ftlib_item_goodsdetailsview_img"
        android:adjustViewBounds="true"
        android:scaleType="fitXY"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
</FrameLayout>

案例源码

https://github.com/myml666/FitnessLib

相关文章

网友评论

      本文标题:Android自定义View实现商城商品详情图片列表

      本文链接:https://www.haomeiwen.com/subject/teegcktx.html