【问题标题】:No ImageView/ImageButton in Material Components (Android)材质组件中没有 ImageView/ImageButton (Android)
【发布时间】:2020-08-06 11:44:36
【问题描述】:

所以我用材料组件设计了我的 android 应用程序,但没有找到 ImageView 和/或 ImageButton 的替代品。

【问题讨论】:

标签: android material-design material-components-android material-components


【解决方案1】:

目前在 v1.1.0 中,没有 MaterialImageViewMaterialImageButton

但在 v1.2.0 中,出现了 ShapeableImageView 扩展 AppCompatImageView

【讨论】:

  • 好的,会调查的。谢谢。
【解决方案2】:

关于ImageView,您可以使用扩展AppCompatImageViewShapeableImageView

你可以使用类似的东西:

<com.google.android.material.imageview.ShapeableImageView
    android:scaleType="centerCrop"
    android:adjustViewBounds="true"
    app:shapeAppearanceOverlay="@style/customImageViewRounded"
    app:srcCompat="@drawable/...."

与:

  <style name="customImageViewRounded" parent="">
    <item name="cornerFamily">rounded</item>
    <item name="cornerSize">32dp</item>

    <item name="cornerFamilyBottomRight">cut</item>
    <item name="cornerSizeBottomRight">50%</item>
    <item name="cornerSizeBottomLeft">0dp</item>
  </style>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-12-16
    • 1970-01-01
    • 2020-02-08
    • 1970-01-01
    • 1970-01-01
    • 2018-01-18
    • 1970-01-01
    • 2019-04-20
    相关资源
    最近更新 更多