gpt4 book ai didi

android - 如何为二维码扫描器绘制四个边界角

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:21:05 26 4
gpt4 key购买 nike

enter image description here

如何为二维码绘制四个边界?

最佳答案

我为此创建了一个矢量可绘制对象:

<vector 
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="220dp" android:height="220dp" android:viewportHeight="230.0" android:viewportWidth="230.0">
<path android:fillColor="#00000000" android:fillType="evenOdd"
android:pathData="M165,5C178.2,5 198.2,5 225,5L225,30.79L225,65"
android:strokeColor="@color/qr_code_reader_square" android:strokeWidth="10"/>
<path android:fillColor="#00000000" android:fillType="evenOdd"
android:pathData="M5,65C5,51.8 5,31.8 5,5L30.79,5L65,5"
android:strokeColor="@color/qr_code_reader_square" android:strokeWidth="10"/>
<path android:fillColor="#00000000" android:fillType="evenOdd"
android:pathData="M165,225C178.2,225 198.2,225 225,225L225,199.21L225,165"
android:strokeColor="@color/qr_code_reader_square" android:strokeWidth="10"/>
<path android:fillColor="#00000000" android:fillType="evenOdd"
android:pathData="M5,165C5,178.2 5,198.2 5,225L30.79,225L65,225"
android:strokeColor="@color/qr_code_reader_square" android:strokeWidth="10"/>
</vector>

您可以将其保存在 res/drawable 中作为 qr_code_reader_square.xml 然后在您的布局中使用它,如下所示:

<FrameLayout
android:layout_width="250dp"
android:layout_height="250dp"
android:background="@drawable/qr_code_reader_square"/>

您还必须在 res/values/colors.xml 中设置颜色:

<color name="qr_code_reader_square">#FFFFFFFF</color>

关于android - 如何为二维码扫描器绘制四个边界角,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38300362/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com