Skip to content

Commit 6ee3f8e

Browse files
Merge pull request #1 from VishalOmprasad/master
Sample demo added
2 parents 20e7910 + 951b7ed commit 6ee3f8e

File tree

96 files changed

+31640
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+31640
-2
lines changed

CustomTooolbar/CustomTooolbar.sln

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.14.36212.18 d17.14
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomTooolbar.UWP", "CustomTooolbar\CustomTooolbar.UWP\CustomTooolbar.UWP.csproj", "{229C23BD-FB40-46B0-BB3E-11ED0D93F2CC}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomTooolbar.Android", "CustomTooolbar\CustomTooolbar.Android\CustomTooolbar.Android.csproj", "{149C76FC-BC3C-4315-8322-AC90A55D9486}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomTooolbar.iOS", "CustomTooolbar\CustomTooolbar.iOS\CustomTooolbar.iOS.csproj", "{A8849329-BA9C-4A81-BE97-8ACF8D1998BD}"
11+
EndProject
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomTooolbar", "CustomTooolbar\CustomTooolbar\CustomTooolbar.csproj", "{360A4170-F25E-4FF1-8429-82A9244FEBF6}"
13+
EndProject
14+
Global
15+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
16+
Debug|ARM = Debug|ARM
17+
Debug|x64 = Debug|x64
18+
Debug|x86 = Debug|x86
19+
Release|ARM = Release|ARM
20+
Release|x64 = Release|x64
21+
Release|x86 = Release|x86
22+
EndGlobalSection
23+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
24+
{229C23BD-FB40-46B0-BB3E-11ED0D93F2CC}.Debug|ARM.ActiveCfg = Debug|ARM
25+
{229C23BD-FB40-46B0-BB3E-11ED0D93F2CC}.Debug|ARM.Build.0 = Debug|ARM
26+
{229C23BD-FB40-46B0-BB3E-11ED0D93F2CC}.Debug|ARM.Deploy.0 = Debug|ARM
27+
{229C23BD-FB40-46B0-BB3E-11ED0D93F2CC}.Debug|x64.ActiveCfg = Debug|x64
28+
{229C23BD-FB40-46B0-BB3E-11ED0D93F2CC}.Debug|x64.Build.0 = Debug|x64
29+
{229C23BD-FB40-46B0-BB3E-11ED0D93F2CC}.Debug|x64.Deploy.0 = Debug|x64
30+
{229C23BD-FB40-46B0-BB3E-11ED0D93F2CC}.Debug|x86.ActiveCfg = Debug|x86
31+
{229C23BD-FB40-46B0-BB3E-11ED0D93F2CC}.Debug|x86.Build.0 = Debug|x86
32+
{229C23BD-FB40-46B0-BB3E-11ED0D93F2CC}.Debug|x86.Deploy.0 = Debug|x86
33+
{229C23BD-FB40-46B0-BB3E-11ED0D93F2CC}.Release|ARM.ActiveCfg = Release|ARM
34+
{229C23BD-FB40-46B0-BB3E-11ED0D93F2CC}.Release|ARM.Build.0 = Release|ARM
35+
{229C23BD-FB40-46B0-BB3E-11ED0D93F2CC}.Release|ARM.Deploy.0 = Release|ARM
36+
{229C23BD-FB40-46B0-BB3E-11ED0D93F2CC}.Release|x64.ActiveCfg = Release|x64
37+
{229C23BD-FB40-46B0-BB3E-11ED0D93F2CC}.Release|x64.Build.0 = Release|x64
38+
{229C23BD-FB40-46B0-BB3E-11ED0D93F2CC}.Release|x64.Deploy.0 = Release|x64
39+
{229C23BD-FB40-46B0-BB3E-11ED0D93F2CC}.Release|x86.ActiveCfg = Release|x86
40+
{229C23BD-FB40-46B0-BB3E-11ED0D93F2CC}.Release|x86.Build.0 = Release|x86
41+
{229C23BD-FB40-46B0-BB3E-11ED0D93F2CC}.Release|x86.Deploy.0 = Release|x86
42+
{149C76FC-BC3C-4315-8322-AC90A55D9486}.Debug|ARM.ActiveCfg = Debug|Any CPU
43+
{149C76FC-BC3C-4315-8322-AC90A55D9486}.Debug|ARM.Build.0 = Debug|Any CPU
44+
{149C76FC-BC3C-4315-8322-AC90A55D9486}.Debug|ARM.Deploy.0 = Debug|Any CPU
45+
{149C76FC-BC3C-4315-8322-AC90A55D9486}.Debug|x64.ActiveCfg = Debug|Any CPU
46+
{149C76FC-BC3C-4315-8322-AC90A55D9486}.Debug|x64.Build.0 = Debug|Any CPU
47+
{149C76FC-BC3C-4315-8322-AC90A55D9486}.Debug|x64.Deploy.0 = Debug|Any CPU
48+
{149C76FC-BC3C-4315-8322-AC90A55D9486}.Debug|x86.ActiveCfg = Debug|Any CPU
49+
{149C76FC-BC3C-4315-8322-AC90A55D9486}.Debug|x86.Build.0 = Debug|Any CPU
50+
{149C76FC-BC3C-4315-8322-AC90A55D9486}.Debug|x86.Deploy.0 = Debug|Any CPU
51+
{149C76FC-BC3C-4315-8322-AC90A55D9486}.Release|ARM.ActiveCfg = Release|Any CPU
52+
{149C76FC-BC3C-4315-8322-AC90A55D9486}.Release|ARM.Build.0 = Release|Any CPU
53+
{149C76FC-BC3C-4315-8322-AC90A55D9486}.Release|ARM.Deploy.0 = Release|Any CPU
54+
{149C76FC-BC3C-4315-8322-AC90A55D9486}.Release|x64.ActiveCfg = Release|Any CPU
55+
{149C76FC-BC3C-4315-8322-AC90A55D9486}.Release|x64.Build.0 = Release|Any CPU
56+
{149C76FC-BC3C-4315-8322-AC90A55D9486}.Release|x64.Deploy.0 = Release|Any CPU
57+
{149C76FC-BC3C-4315-8322-AC90A55D9486}.Release|x86.ActiveCfg = Release|Any CPU
58+
{149C76FC-BC3C-4315-8322-AC90A55D9486}.Release|x86.Build.0 = Release|Any CPU
59+
{149C76FC-BC3C-4315-8322-AC90A55D9486}.Release|x86.Deploy.0 = Release|Any CPU
60+
{A8849329-BA9C-4A81-BE97-8ACF8D1998BD}.Debug|ARM.ActiveCfg = Debug|iPhoneSimulator
61+
{A8849329-BA9C-4A81-BE97-8ACF8D1998BD}.Debug|ARM.Build.0 = Debug|iPhoneSimulator
62+
{A8849329-BA9C-4A81-BE97-8ACF8D1998BD}.Debug|ARM.Deploy.0 = Debug|iPhoneSimulator
63+
{A8849329-BA9C-4A81-BE97-8ACF8D1998BD}.Debug|x64.ActiveCfg = Debug|iPhone
64+
{A8849329-BA9C-4A81-BE97-8ACF8D1998BD}.Debug|x64.Build.0 = Debug|iPhone
65+
{A8849329-BA9C-4A81-BE97-8ACF8D1998BD}.Debug|x64.Deploy.0 = Debug|iPhone
66+
{A8849329-BA9C-4A81-BE97-8ACF8D1998BD}.Debug|x86.ActiveCfg = Debug|iPhoneSimulator
67+
{A8849329-BA9C-4A81-BE97-8ACF8D1998BD}.Debug|x86.Build.0 = Debug|iPhoneSimulator
68+
{A8849329-BA9C-4A81-BE97-8ACF8D1998BD}.Debug|x86.Deploy.0 = Debug|iPhoneSimulator
69+
{A8849329-BA9C-4A81-BE97-8ACF8D1998BD}.Release|ARM.ActiveCfg = Release|iPhoneSimulator
70+
{A8849329-BA9C-4A81-BE97-8ACF8D1998BD}.Release|ARM.Build.0 = Release|iPhoneSimulator
71+
{A8849329-BA9C-4A81-BE97-8ACF8D1998BD}.Release|ARM.Deploy.0 = Release|iPhoneSimulator
72+
{A8849329-BA9C-4A81-BE97-8ACF8D1998BD}.Release|x64.ActiveCfg = Release|iPhoneSimulator
73+
{A8849329-BA9C-4A81-BE97-8ACF8D1998BD}.Release|x64.Build.0 = Release|iPhoneSimulator
74+
{A8849329-BA9C-4A81-BE97-8ACF8D1998BD}.Release|x64.Deploy.0 = Release|iPhoneSimulator
75+
{A8849329-BA9C-4A81-BE97-8ACF8D1998BD}.Release|x86.ActiveCfg = Release|iPhoneSimulator
76+
{A8849329-BA9C-4A81-BE97-8ACF8D1998BD}.Release|x86.Build.0 = Release|iPhoneSimulator
77+
{A8849329-BA9C-4A81-BE97-8ACF8D1998BD}.Release|x86.Deploy.0 = Release|iPhoneSimulator
78+
{360A4170-F25E-4FF1-8429-82A9244FEBF6}.Debug|ARM.ActiveCfg = Debug|Any CPU
79+
{360A4170-F25E-4FF1-8429-82A9244FEBF6}.Debug|ARM.Build.0 = Debug|Any CPU
80+
{360A4170-F25E-4FF1-8429-82A9244FEBF6}.Debug|ARM.Deploy.0 = Debug|Any CPU
81+
{360A4170-F25E-4FF1-8429-82A9244FEBF6}.Debug|x64.ActiveCfg = Debug|Any CPU
82+
{360A4170-F25E-4FF1-8429-82A9244FEBF6}.Debug|x64.Build.0 = Debug|Any CPU
83+
{360A4170-F25E-4FF1-8429-82A9244FEBF6}.Debug|x64.Deploy.0 = Debug|Any CPU
84+
{360A4170-F25E-4FF1-8429-82A9244FEBF6}.Debug|x86.ActiveCfg = Debug|Any CPU
85+
{360A4170-F25E-4FF1-8429-82A9244FEBF6}.Debug|x86.Build.0 = Debug|Any CPU
86+
{360A4170-F25E-4FF1-8429-82A9244FEBF6}.Debug|x86.Deploy.0 = Debug|Any CPU
87+
{360A4170-F25E-4FF1-8429-82A9244FEBF6}.Release|ARM.ActiveCfg = Release|Any CPU
88+
{360A4170-F25E-4FF1-8429-82A9244FEBF6}.Release|ARM.Build.0 = Release|Any CPU
89+
{360A4170-F25E-4FF1-8429-82A9244FEBF6}.Release|ARM.Deploy.0 = Release|Any CPU
90+
{360A4170-F25E-4FF1-8429-82A9244FEBF6}.Release|x64.ActiveCfg = Release|Any CPU
91+
{360A4170-F25E-4FF1-8429-82A9244FEBF6}.Release|x64.Build.0 = Release|Any CPU
92+
{360A4170-F25E-4FF1-8429-82A9244FEBF6}.Release|x64.Deploy.0 = Release|Any CPU
93+
{360A4170-F25E-4FF1-8429-82A9244FEBF6}.Release|x86.ActiveCfg = Release|Any CPU
94+
{360A4170-F25E-4FF1-8429-82A9244FEBF6}.Release|x86.Build.0 = Release|Any CPU
95+
{360A4170-F25E-4FF1-8429-82A9244FEBF6}.Release|x86.Deploy.0 = Release|Any CPU
96+
EndGlobalSection
97+
GlobalSection(SolutionProperties) = preSolution
98+
HideSolutionNode = FALSE
99+
EndGlobalSection
100+
GlobalSection(ExtensibilityGlobals) = postSolution
101+
SolutionGuid = {60A91E46-3B6C-4CDF-9C50-878AF827D3FF}
102+
EndGlobalSection
103+
EndGlobal
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Any raw assets you want to be deployed with your application can be placed in
2+
this directory (and child directories) and given a Build Action of "AndroidAsset".
3+
4+
These files will be deployed with your package and will be accessible using Android's
5+
AssetManager, like this:
6+
7+
public class ReadAsset : Activity
8+
{
9+
protected override void OnCreate (Bundle bundle)
10+
{
11+
base.OnCreate (bundle);
12+
13+
InputStream input = Assets.Open ("my_asset.txt");
14+
}
15+
}
16+
17+
Additionally, some Android functions will automatically load asset files:
18+
19+
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProjectGuid>{149C76FC-BC3C-4315-8322-AC90A55D9486}</ProjectGuid>
7+
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
8+
<TemplateGuid>{c9e5eea5-ca05-42a1-839b-61506e0a37df}</TemplateGuid>
9+
<OutputType>Library</OutputType>
10+
<RootNamespace>CustomTooolbar.Droid</RootNamespace>
11+
<AssemblyName>CustomTooolbar.Android</AssemblyName>
12+
<Deterministic>True</Deterministic>
13+
<AndroidApplication>True</AndroidApplication>
14+
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
15+
<AndroidResgenClass>Resource</AndroidResgenClass>
16+
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
17+
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
18+
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
19+
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
20+
<TargetFrameworkVersion>v13.0</TargetFrameworkVersion>
21+
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
22+
<AndroidUseAapt2>true</AndroidUseAapt2>
23+
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
24+
<NuGetPackageImportStamp>
25+
</NuGetPackageImportStamp>
26+
</PropertyGroup>
27+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
28+
<DebugSymbols>true</DebugSymbols>
29+
<DebugType>portable</DebugType>
30+
<Optimize>false</Optimize>
31+
<OutputPath>bin\Debug</OutputPath>
32+
<DefineConstants>DEBUG;</DefineConstants>
33+
<ErrorReport>prompt</ErrorReport>
34+
<WarningLevel>4</WarningLevel>
35+
<AndroidLinkMode>None</AndroidLinkMode>
36+
<EmbedAssembliesIntoApk>false</EmbedAssembliesIntoApk>
37+
</PropertyGroup>
38+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
39+
<DebugSymbols>true</DebugSymbols>
40+
<DebugType>portable</DebugType>
41+
<Optimize>true</Optimize>
42+
<OutputPath>bin\Release</OutputPath>
43+
<ErrorReport>prompt</ErrorReport>
44+
<WarningLevel>4</WarningLevel>
45+
<AndroidManagedSymbols>true</AndroidManagedSymbols>
46+
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
47+
</PropertyGroup>
48+
<ItemGroup>
49+
<Reference Include="Mono.Android" />
50+
<Reference Include="System" />
51+
<Reference Include="System.Core" />
52+
<Reference Include="System.Xml.Linq" />
53+
<Reference Include="System.Xml" />
54+
<Reference Include="System.Numerics" />
55+
<Reference Include="System.Numerics.Vectors" />
56+
</ItemGroup>
57+
<ItemGroup>
58+
<PackageReference Include="Syncfusion.Xamarin.SfImageEditor">
59+
<Version>30.2.4</Version>
60+
</PackageReference>
61+
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2196" />
62+
<PackageReference Include="Xamarin.Essentials" Version="1.7.0" />
63+
</ItemGroup>
64+
<ItemGroup>
65+
<Compile Include="MainActivity.cs" />
66+
<Compile Include="Resources\Resource.designer.cs" />
67+
<Compile Include="Properties\AssemblyInfo.cs" />
68+
</ItemGroup>
69+
<ItemGroup>
70+
<None Include="Resources\AboutResources.txt" />
71+
<None Include="Assets\AboutAssets.txt" />
72+
<None Include="Properties\AndroidManifest.xml" />
73+
</ItemGroup>
74+
<ItemGroup>
75+
<AndroidResource Include="Resources\values\styles.xml" />
76+
<AndroidResource Include="Resources\values\colors.xml" />
77+
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon.xml" />
78+
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon_round.xml" />
79+
<AndroidResource Include="Resources\mipmap-hdpi\icon.png" />
80+
<AndroidResource Include="Resources\mipmap-hdpi\launcher_foreground.png" />
81+
<AndroidResource Include="Resources\mipmap-mdpi\icon.png" />
82+
<AndroidResource Include="Resources\mipmap-mdpi\launcher_foreground.png" />
83+
<AndroidResource Include="Resources\mipmap-xhdpi\icon.png" />
84+
<AndroidResource Include="Resources\mipmap-xhdpi\launcher_foreground.png" />
85+
<AndroidResource Include="Resources\mipmap-xxhdpi\icon.png" />
86+
<AndroidResource Include="Resources\mipmap-xxhdpi\launcher_foreground.png" />
87+
<AndroidResource Include="Resources\mipmap-xxxhdpi\icon.png" />
88+
<AndroidResource Include="Resources\mipmap-xxxhdpi\launcher_foreground.png" />
89+
</ItemGroup>
90+
<ItemGroup>
91+
<Folder Include="Resources\drawable\" />
92+
</ItemGroup>
93+
<ItemGroup>
94+
<ProjectReference Include="..\CustomTooolbar\CustomTooolbar.csproj">
95+
<Project>{03CD4B50-5027-4B77-93BC-773FEFC7AD67}</Project>
96+
<Name>CustomTooolbar</Name>
97+
</ProjectReference>
98+
</ItemGroup>
99+
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
100+
</Project>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
3+
using Android.App;
4+
using Android.Content.PM;
5+
using Android.Runtime;
6+
using Android.OS;
7+
8+
namespace CustomTooolbar.Droid
9+
{
10+
[Activity(Label = "CustomTooolbar", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize )]
11+
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
12+
{
13+
protected override void OnCreate(Bundle savedInstanceState)
14+
{
15+
base.OnCreate(savedInstanceState);
16+
17+
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
18+
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
19+
LoadApplication(new App());
20+
}
21+
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
22+
{
23+
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
24+
25+
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
26+
}
27+
}
28+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.customtooolbar">
3+
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33" />
4+
<application android:label="CustomTooolbar.Android" android:theme="@style/MainTheme"></application>
5+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
6+
</manifest>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
using Android.App;
5+
6+
// General Information about an assembly is controlled through the following
7+
// set of attributes. Change these attribute values to modify the information
8+
// associated with an assembly.
9+
[assembly: AssemblyTitle("CustomTooolbar.Android")]
10+
[assembly: AssemblyDescription("")]
11+
[assembly: AssemblyConfiguration("")]
12+
[assembly: AssemblyCompany("")]
13+
[assembly: AssemblyProduct("CustomTooolbar.Android")]
14+
[assembly: AssemblyCopyright("Copyright © 2014")]
15+
[assembly: AssemblyTrademark("")]
16+
[assembly: AssemblyCulture("")]
17+
[assembly: ComVisible(false)]
18+
19+
// Version information for an assembly consists of the following four values:
20+
//
21+
// Major Version
22+
// Minor Version
23+
// Build Number
24+
// Revision
25+
[assembly: AssemblyVersion("1.0.0.0")]
26+
[assembly: AssemblyFileVersion("1.0.0.0")]
27+
28+
// Add some common permissions, these can be removed if not needed
29+
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
30+
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
Images, layout descriptions, binary blobs and string dictionaries can be included
2+
in your application as resource files. Various Android APIs are designed to
3+
operate on the resource IDs instead of dealing with images, strings or binary blobs
4+
directly.
5+
6+
For example, a sample Android app that contains a user interface layout (main.xml),
7+
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
8+
would keep its resources in the "Resources" directory of the application:
9+
10+
Resources/
11+
drawable-hdpi/
12+
icon.png
13+
14+
drawable-ldpi/
15+
icon.png
16+
17+
drawable-mdpi/
18+
icon.png
19+
20+
layout/
21+
main.xml
22+
23+
values/
24+
strings.xml
25+
26+
In order to get the build system to recognize Android resources, set the build action to
27+
"AndroidResource". The native Android APIs do not operate directly with filenames, but
28+
instead operate on resource IDs. When you compile an Android application that uses resources,
29+
the build system will package the resources for distribution and generate a class called
30+
"Resource" that contains the tokens for each one of the resources included. For example,
31+
for the above Resources layout, this is what the Resource class would expose:
32+
33+
public class Resource {
34+
public class drawable {
35+
public const int icon = 0x123;
36+
}
37+
38+
public class layout {
39+
public const int main = 0x456;
40+
}
41+
42+
public class strings {
43+
public const int first_string = 0xabc;
44+
public const int second_string = 0xbcd;
45+
}
46+
}
47+
48+
You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main
49+
to reference the layout/main.xml file, or Resource.strings.first_string to reference the first
50+
string in the dictionary file values/strings.xml.

0 commit comments

Comments
 (0)