@ -0,0 +1,19 @@ |
||||
Any raw assets you want to be deployed with your application can be placed in |
||||
this directory (and child directories) and given a Build Action of "AndroidAsset". |
||||
|
||||
These files will be deployed with your package and will be accessible using Android's |
||||
AssetManager, like this: |
||||
|
||||
public class ReadAsset : Activity |
||||
{ |
||||
protected override void OnCreate (Bundle bundle) |
||||
{ |
||||
base.OnCreate (bundle); |
||||
|
||||
InputStream input = Assets.Open ("my_asset.txt"); |
||||
} |
||||
} |
||||
|
||||
Additionally, some Android functions will automatically load asset files: |
||||
|
||||
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); |
@ -0,0 +1,6 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.barcodereader"> |
||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31" /> |
||||
<application android:label="BarcodeReader.Android" android:theme="@style/MainTheme"></application> |
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
||||
</manifest> |
@ -0,0 +1,50 @@ |
||||
Images, layout descriptions, binary blobs and string dictionaries can be included |
||||
in your application as resource files. Various Android APIs are designed to |
||||
operate on the resource IDs instead of dealing with images, strings or binary blobs |
||||
directly. |
||||
|
||||
For example, a sample Android app that contains a user interface layout (main.xml), |
||||
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) |
||||
would keep its resources in the "Resources" directory of the application: |
||||
|
||||
Resources/ |
||||
drawable-hdpi/ |
||||
icon.png |
||||
|
||||
drawable-ldpi/ |
||||
icon.png |
||||
|
||||
drawable-mdpi/ |
||||
icon.png |
||||
|
||||
layout/ |
||||
main.xml |
||||
|
||||
values/ |
||||
strings.xml |
||||
|
||||
In order to get the build system to recognize Android resources, set the build action to |
||||
"AndroidResource". The native Android APIs do not operate directly with filenames, but |
||||
instead operate on resource IDs. When you compile an Android application that uses resources, |
||||
the build system will package the resources for distribution and generate a class called |
||||
"Resource" that contains the tokens for each one of the resources included. For example, |
||||
for the above Resources layout, this is what the Resource class would expose: |
||||
|
||||
public class Resource { |
||||
public class drawable { |
||||
public const int icon = 0x123; |
||||
} |
||||
|
||||
public class layout { |
||||
public const int main = 0x456; |
||||
} |
||||
|
||||
public class strings { |
||||
public const int first_string = 0xabc; |
||||
public const int second_string = 0xbcd; |
||||
} |
||||
} |
||||
|
||||
You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main |
||||
to reference the layout/main.xml file, or Resource.strings.first_string to reference the first |
||||
string in the dictionary file values/strings.xml. |
After Width: | Height: | Size: 8.3 KiB |
@ -0,0 +1,5 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<background android:drawable="@color/launcher_background" /> |
||||
<foreground android:drawable="@mipmap/launcher_foreground" /> |
||||
</adaptive-icon> |
@ -0,0 +1,5 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<background android:drawable="@color/launcher_background" /> |
||||
<foreground android:drawable="@mipmap/launcher_foreground" /> |
||||
</adaptive-icon> |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 51 KiB |
@ -0,0 +1,7 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<resources> |
||||
<color name="launcher_background">#FFFFFF</color> |
||||
<color name="colorPrimary">#3F51B5</color> |
||||
<color name="colorPrimaryDark">#303F9F</color> |
||||
<color name="colorAccent">#FF4081</color> |
||||
</resources> |
@ -0,0 +1,18 @@ |
||||
<?xml version="1.0" encoding="utf-8" ?> |
||||
<resources> |
||||
|
||||
<style name="MainTheme" parent="MainTheme.Base"> |
||||
<!-- As of Xamarin.Forms 4.6 the theme has moved into the Forms binary --> |
||||
<!-- If you want to override anything you can do that here. --> |
||||
<!-- Underneath are a couple of entries to get you started. --> |
||||
|
||||
<!-- Set theme colors from https://aka.ms/material-colors --> |
||||
<!-- colorPrimary is used for the default action bar background --> |
||||
<!--<item name="colorPrimary">#2196F3</item>--> |
||||
<!-- colorPrimaryDark is used for the status bar --> |
||||
<!--<item name="colorPrimaryDark">#1976D2</item>--> |
||||
<!-- colorAccent is used as the default value for colorControlActivated |
||||
which is used to tint widgets --> |
||||
<!--<item name="colorAccent">#FF4081</item>--> |
||||
</style> |
||||
</resources> |
@ -0,0 +1,3 @@ |
||||
using Xamarin.Forms.Xaml; |
||||
|
||||
[assembly: XamlCompilation(XamlCompilationOptions.Compile)] |
@ -0,0 +1,18 @@ |
||||
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
||||
<PropertyGroup> |
||||
<TargetFramework>netstandard2.0</TargetFramework> |
||||
<ProduceReferenceAssembly>true</ProduceReferenceAssembly> |
||||
</PropertyGroup> |
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> |
||||
<DebugType>portable</DebugType> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
</PropertyGroup> |
||||
|
||||
<ItemGroup> |
||||
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2196" /> |
||||
<PackageReference Include="Xamarin.Essentials" Version="1.7.0" /> |
||||
<PackageReference Include="ZXing.Net.Mobile.Forms" Version="3.1.0-beta2" /> |
||||
</ItemGroup> |
||||
</Project> |