android - 如何在 Android 的 Imageview 上制作正弦波?

标签 android vector imageview android-imageview

我想创建与此类似的图像。

CardView Item

是否可以用 XML 完成?如果不是,我将如何缩放像这样形状的图像?

最佳答案

是的,这是可能的,你可以使用 vactor drawable

    <?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="640dp"
android:height="640dp"
android:viewportWidth="640"
android:viewportHeight="640">

<path
    android:fillColor="#000000"
    android:fillAlpha="0"
    android:strokeColor="#000000"
    android:strokeWidth="1"
    android:pathData="" />
<path
    android:fillColor="#000000"
    android:fillAlpha="0"
    android:strokeColor="#000000"
    android:strokeWidth="1"
    android:pathData="" />
<path
    android:fillColor="#000000"
    android:strokeWidth="1"
    android:pathData="M0 640L637.5 640L637.5 519.77C528.33 483.94 424.58 482.69 326.25 516.02C227.91 549.35 119.17 545.6 0 504.77L0 640Z" />
<path
    android:fillColor="#000000"
    android:fillAlpha="0"
    android:strokeColor="#000000"
    android:strokeWidth="1"
    android:pathData="M0 640L637.5 640L637.5 519.77C528.33 483.94 424.58 482.69 326.25 516.02C227.91 549.35 119.17 545.6 0 504.77L0 640Z" />
<path
    android:fillColor="#000000"
    android:fillAlpha="0"
    android:strokeColor="#000000"
    android:strokeWidth="1"
    android:pathData="M0 640L637.5 640L637.5 519.77C528.33 483.94 424.58 482.69 326.25 516.02C227.91 549.35 119.17 545.6 0 504.77L0 640Z" /></vector>

喜欢这张图片enter image description here

关于android - 如何在 Android 的 Imageview 上制作正弦波?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43468066/

相关文章:

android - 放弃支持库 v7。我做错了什么?

android - 执行 aapt 时出错 : Return code 132 problems

python - 为什么我在 NumPy 中的矩阵向​​量乘法生成二维数组而不是一维向量?

C++ - 将 double vector 作为元组迭代

java - 如何以编程方式设置 imageView 的高度?

java - 如何在Android中的ImageView中显示验证码?

android - 在现有联系人个人资料 android 中添加应用程序链接

java - 添加平板电脑支持 : Fragments and Activities for Master/Detail (Android)

Android ImageView 投影

c++ - 如何保持指向存储在 vector 中的结构的指针有效?