温馨提示:本文翻译自stackoverflow.com,查看原文请点击:xamarin.android - custom border around camera screen
xamarin.android

xamarin.android - 相机屏幕周围的自定义边框

发布于 2020-06-05 11:48:13

使用此代码为相机绘制自定义边框。

它适用于5以上的版本。不适用于4.2或4.4以上的版本。

我想修改该文件以在所有版本上工作。

<?xml version="1.0" encoding="utf-8"?>
<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>

查看更多

提问者
maher2020
被浏览
18
Leo Zhu - MSFT 2020-03-23 11:27

您可以使用Android支持库来支持旧版本,该库提供了VectorDrawableCompatAnimatedVectorDrawableCompat类。

请参阅矢量绘图

在Xamarin.Android中,您可以安装nuget VectorCompat