Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Commit ed45071

Browse files
committed
Initial code transfer to public repo
1 parent 7d8ddda commit ed45071

File tree

687 files changed

+31799
-0
lines changed

Some content is hidden

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

687 files changed

+31799
-0
lines changed

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
tools/
2+
bin/
3+
obj/
4+
packages/
5+
externals/
6+
output/
7+
8+
*.xam
9+
*.DS_Store
10+
*.pidb
11+
*.userprefs
12+
*.dotSettings
13+
*.suo
14+
*.a
15+
*.xcuserstate
16+
*.xcuserstate
17+
18+
Resource.designer.cs
19+
component.yaml

AndroidSupport.sln

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2012
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V4", "v4\source\V4.csproj", "{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}"
5+
EndProject
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V13", "v13\source\V13.csproj", "{69351B41-DA07-42F6-9083-0080EBC6407D}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V7-CardView", "v7-cardview\source\V7-CardView.csproj", "{E9848EF1-14E6-4144-95A0-926A52F301B5}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V7-GridLayout", "v7-gridlayout\source\V7-GridLayout.csproj", "{D33F5F79-994B-4C34-BCC3-2B30CB630F1B}"
11+
EndProject
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V7-RecyclerView", "v7-recyclerview\source\V7-RecyclerView.csproj", "{514ED7A8-0F25-4F61-B7B3-A4A652FD7192}"
13+
EndProject
14+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V7-Palette", "v7-palette\source\V7-Palette.csproj", "{D9C9670F-8B06-4083-9EEF-42E4D1DE22C1}"
15+
EndProject
16+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V7-Preference", "v7-preference\source\V7-Preference.csproj", "{A419C738-BD3D-4460-97E9-B8E44FC26896}"
17+
EndProject
18+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V7-AppCompat", "v7-appcompat\source\V7-AppCompat.csproj", "{B4ED245B-BBD8-4549-9990-476A36AAD381}"
19+
EndProject
20+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V8-RenderScript", "v8-renderscript\source\V8-RenderScript.csproj", "{732E9891-9FEE-4493-8C1C-C06F12C5248B}"
21+
EndProject
22+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V14-Preference", "v14-preference\source\V14-Preference.csproj", "{E2ACB402-B348-4CD9-9686-9F029DCB3277}"
23+
EndProject
24+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V7-MediaRouter", "v7-mediarouter\source\V7-MediaRouter.csproj", "{9E11B536-73E2-4BC6-9921-92889CF089CB}"
25+
EndProject
26+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V17-Leanback", "v17-leanback\source\V17-Leanback.csproj", "{DA26C0C2-286A-4B41-9DF7-84D7E5D00C68}"
27+
EndProject
28+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V17-Preference-Leanback", "v17-preference-leanback\source\V17-Preference-Leanback.csproj", "{6948B25E-4A71-4F31-B042-D21B0B99ADA1}"
29+
EndProject
30+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomTabs", "customtabs\source\CustomTabs.csproj", "{5B33CEC5-C89D-4C5B-8365-17C83CCFAD4C}"
31+
EndProject
32+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Design", "design\source\Design.csproj", "{8022A1F5-C228-4B21-8194-BC9E76F9174A}"
33+
EndProject
34+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Percent", "percent\source\Percent.csproj", "{A557F298-10FD-4F47-8C96-20387E2AA741}"
35+
EndProject
36+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Recommendation", "recommendation\source\Recommendation.csproj", "{257D3C55-FADE-4C65-9967-7DCDE23F83A8}"
37+
EndProject
38+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Animated-Vector-Drawable", "animated-vector-drawable\source\Animated-Vector-Drawable.csproj", "{75CB848E-6EE8-4DAF-8AD4-1782641F69D3}"
39+
EndProject
40+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vector-Drawable", "vector-drawable\source\Vector-Drawable.csproj", "{418B64BA-2BAC-4B92-8888-CAFEAAF7E860}"
41+
EndProject
42+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vector-Drawable-BuildTasks", "vector-drawable\buildtask\Vector-Drawable-BuildTasks.csproj", "{DB19F806-FEF2-4BBB-8A0B-37EA54DB3A0D}"
43+
EndProject
44+
Global
45+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
46+
Debug|Any CPU = Debug|Any CPU
47+
Release|Any CPU = Release|Any CPU
48+
EndGlobalSection
49+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
50+
{257D3C55-FADE-4C65-9967-7DCDE23F83A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
51+
{257D3C55-FADE-4C65-9967-7DCDE23F83A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
52+
{257D3C55-FADE-4C65-9967-7DCDE23F83A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
53+
{257D3C55-FADE-4C65-9967-7DCDE23F83A8}.Release|Any CPU.Build.0 = Release|Any CPU
54+
{418B64BA-2BAC-4B92-8888-CAFEAAF7E860}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
55+
{418B64BA-2BAC-4B92-8888-CAFEAAF7E860}.Debug|Any CPU.Build.0 = Debug|Any CPU
56+
{418B64BA-2BAC-4B92-8888-CAFEAAF7E860}.Release|Any CPU.ActiveCfg = Release|Any CPU
57+
{418B64BA-2BAC-4B92-8888-CAFEAAF7E860}.Release|Any CPU.Build.0 = Release|Any CPU
58+
{514ED7A8-0F25-4F61-B7B3-A4A652FD7192}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
59+
{514ED7A8-0F25-4F61-B7B3-A4A652FD7192}.Debug|Any CPU.Build.0 = Debug|Any CPU
60+
{514ED7A8-0F25-4F61-B7B3-A4A652FD7192}.Release|Any CPU.ActiveCfg = Release|Any CPU
61+
{514ED7A8-0F25-4F61-B7B3-A4A652FD7192}.Release|Any CPU.Build.0 = Release|Any CPU
62+
{5B33CEC5-C89D-4C5B-8365-17C83CCFAD4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
63+
{5B33CEC5-C89D-4C5B-8365-17C83CCFAD4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
64+
{5B33CEC5-C89D-4C5B-8365-17C83CCFAD4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
65+
{5B33CEC5-C89D-4C5B-8365-17C83CCFAD4C}.Release|Any CPU.Build.0 = Release|Any CPU
66+
{69351B41-DA07-42F6-9083-0080EBC6407D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
67+
{69351B41-DA07-42F6-9083-0080EBC6407D}.Debug|Any CPU.Build.0 = Debug|Any CPU
68+
{69351B41-DA07-42F6-9083-0080EBC6407D}.Release|Any CPU.ActiveCfg = Release|Any CPU
69+
{69351B41-DA07-42F6-9083-0080EBC6407D}.Release|Any CPU.Build.0 = Release|Any CPU
70+
{6948B25E-4A71-4F31-B042-D21B0B99ADA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
71+
{6948B25E-4A71-4F31-B042-D21B0B99ADA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
72+
{6948B25E-4A71-4F31-B042-D21B0B99ADA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
73+
{6948B25E-4A71-4F31-B042-D21B0B99ADA1}.Release|Any CPU.Build.0 = Release|Any CPU
74+
{732E9891-9FEE-4493-8C1C-C06F12C5248B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
75+
{732E9891-9FEE-4493-8C1C-C06F12C5248B}.Debug|Any CPU.Build.0 = Debug|Any CPU
76+
{732E9891-9FEE-4493-8C1C-C06F12C5248B}.Release|Any CPU.ActiveCfg = Release|Any CPU
77+
{732E9891-9FEE-4493-8C1C-C06F12C5248B}.Release|Any CPU.Build.0 = Release|Any CPU
78+
{75CB848E-6EE8-4DAF-8AD4-1782641F69D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
79+
{75CB848E-6EE8-4DAF-8AD4-1782641F69D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
80+
{75CB848E-6EE8-4DAF-8AD4-1782641F69D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
81+
{75CB848E-6EE8-4DAF-8AD4-1782641F69D3}.Release|Any CPU.Build.0 = Release|Any CPU
82+
{8022A1F5-C228-4B21-8194-BC9E76F9174A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
83+
{8022A1F5-C228-4B21-8194-BC9E76F9174A}.Debug|Any CPU.Build.0 = Debug|Any CPU
84+
{8022A1F5-C228-4B21-8194-BC9E76F9174A}.Release|Any CPU.ActiveCfg = Release|Any CPU
85+
{8022A1F5-C228-4B21-8194-BC9E76F9174A}.Release|Any CPU.Build.0 = Release|Any CPU
86+
{9E11B536-73E2-4BC6-9921-92889CF089CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
87+
{9E11B536-73E2-4BC6-9921-92889CF089CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
88+
{9E11B536-73E2-4BC6-9921-92889CF089CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
89+
{9E11B536-73E2-4BC6-9921-92889CF089CB}.Release|Any CPU.Build.0 = Release|Any CPU
90+
{A419C738-BD3D-4460-97E9-B8E44FC26896}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
91+
{A419C738-BD3D-4460-97E9-B8E44FC26896}.Debug|Any CPU.Build.0 = Debug|Any CPU
92+
{A419C738-BD3D-4460-97E9-B8E44FC26896}.Release|Any CPU.ActiveCfg = Release|Any CPU
93+
{A419C738-BD3D-4460-97E9-B8E44FC26896}.Release|Any CPU.Build.0 = Release|Any CPU
94+
{A557F298-10FD-4F47-8C96-20387E2AA741}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
95+
{A557F298-10FD-4F47-8C96-20387E2AA741}.Debug|Any CPU.Build.0 = Debug|Any CPU
96+
{A557F298-10FD-4F47-8C96-20387E2AA741}.Release|Any CPU.ActiveCfg = Release|Any CPU
97+
{A557F298-10FD-4F47-8C96-20387E2AA741}.Release|Any CPU.Build.0 = Release|Any CPU
98+
{B4ED245B-BBD8-4549-9990-476A36AAD381}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
99+
{B4ED245B-BBD8-4549-9990-476A36AAD381}.Debug|Any CPU.Build.0 = Debug|Any CPU
100+
{B4ED245B-BBD8-4549-9990-476A36AAD381}.Release|Any CPU.ActiveCfg = Release|Any CPU
101+
{B4ED245B-BBD8-4549-9990-476A36AAD381}.Release|Any CPU.Build.0 = Release|Any CPU
102+
{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
103+
{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
104+
{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
105+
{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}.Release|Any CPU.Build.0 = Release|Any CPU
106+
{D33F5F79-994B-4C34-BCC3-2B30CB630F1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
107+
{D33F5F79-994B-4C34-BCC3-2B30CB630F1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
108+
{D33F5F79-994B-4C34-BCC3-2B30CB630F1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
109+
{D33F5F79-994B-4C34-BCC3-2B30CB630F1B}.Release|Any CPU.Build.0 = Release|Any CPU
110+
{D9C9670F-8B06-4083-9EEF-42E4D1DE22C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
111+
{D9C9670F-8B06-4083-9EEF-42E4D1DE22C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
112+
{D9C9670F-8B06-4083-9EEF-42E4D1DE22C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
113+
{D9C9670F-8B06-4083-9EEF-42E4D1DE22C1}.Release|Any CPU.Build.0 = Release|Any CPU
114+
{DA26C0C2-286A-4B41-9DF7-84D7E5D00C68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
115+
{DA26C0C2-286A-4B41-9DF7-84D7E5D00C68}.Debug|Any CPU.Build.0 = Debug|Any CPU
116+
{DA26C0C2-286A-4B41-9DF7-84D7E5D00C68}.Release|Any CPU.ActiveCfg = Release|Any CPU
117+
{DA26C0C2-286A-4B41-9DF7-84D7E5D00C68}.Release|Any CPU.Build.0 = Release|Any CPU
118+
{DB19F806-FEF2-4BBB-8A0B-37EA54DB3A0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
119+
{DB19F806-FEF2-4BBB-8A0B-37EA54DB3A0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
120+
{DB19F806-FEF2-4BBB-8A0B-37EA54DB3A0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
121+
{DB19F806-FEF2-4BBB-8A0B-37EA54DB3A0D}.Release|Any CPU.Build.0 = Release|Any CPU
122+
{E2ACB402-B348-4CD9-9686-9F029DCB3277}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
123+
{E2ACB402-B348-4CD9-9686-9F029DCB3277}.Debug|Any CPU.Build.0 = Debug|Any CPU
124+
{E2ACB402-B348-4CD9-9686-9F029DCB3277}.Release|Any CPU.ActiveCfg = Release|Any CPU
125+
{E2ACB402-B348-4CD9-9686-9F029DCB3277}.Release|Any CPU.Build.0 = Release|Any CPU
126+
{E9848EF1-14E6-4144-95A0-926A52F301B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
127+
{E9848EF1-14E6-4144-95A0-926A52F301B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
128+
{E9848EF1-14E6-4144-95A0-926A52F301B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
129+
{E9848EF1-14E6-4144-95A0-926A52F301B5}.Release|Any CPU.Build.0 = Release|Any CPU
130+
EndGlobalSection
131+
EndGlobal

README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Xamarin Component for Android Support Library
2+
3+
Xamarin creates and maintains Xamarin.Android bindings for the Google Android Support Libraries, including:
4+
5+
- Design
6+
- Animated Vector Drawable
7+
- Vector Drawable
8+
- Custom Tabs
9+
- Recommendation
10+
- Support v4
11+
- Support v13
12+
- Support v7 AppCompat
13+
- Support v7 CardView
14+
- Support v7 GridLayout
15+
- Support v7 MediaRouter
16+
- Support v7 Palette
17+
- Support v7 Preference
18+
- Support v7 RecyclerView
19+
- Support v8 RenderScript
20+
- Support v14 Preference
21+
- Support v17 Leanback
22+
- Support v17 Preference Leanback
23+
24+
25+
26+
## Building
27+
28+
### Prerequisites
29+
30+
- Mac OSX 10.11 or higher / Windows 10 or higher (experimental support only)
31+
- Xamarin.Android 6.0 or higher
32+
- Mono 4.3 or higher
33+
- Java JDK 1.7 or higher
34+
- Android SDK with API Levels 15, 16, 17, 18, 21, 23
35+
36+
37+
### Build Scripts
38+
The build script for this project uses [Cake](http://cakebuild.net). To run the build, you can use one of the bootstrapper files either for Mac or Windows:
39+
40+
**Mac**:
41+
```
42+
sh build.sh -target libs
43+
```
44+
45+
**Windows (experimental support only)**:
46+
47+
***NOTE:*** Windows build support is still experimental. You may need to first build the `externals` target, then open the `GooglePlayServices.sln` in Visual Studio, rebuild it, build the `clean` target, and then continue on normally building whichever targets you like. This will ensure the appropriate files are downloaded and cached in your user's AppData folder.
48+
49+
```
50+
powershell .\build.ps1 -Target libs
51+
```
52+
53+
The bootstrapper script will automatically download Cake.exe and all the required tools and files into the `./tools/` folder.
54+
55+
The following targets can be specified:
56+
57+
- `libs` builds the class library bindings (depends on `externals`)
58+
- `externals` downloads the external dependencies
59+
- `samples` builds all of the samples (depends on `libs`)
60+
- `nuget` builds the nuget packages (depends on `libs`)
61+
- `component` builds the xamarin components (depends on `samples` and `nuget`)
62+
- `clean` cleans up everything
63+
64+
***NOTE***: The `externals` build task may take awhile to run as it downloads several large dependencies.
65+
66+
You may want to consider passing `-verbosity diagnostic` to the bootstrapper to enable more verbose output, including downloading progress.
67+
68+
69+
### Working in Visual Studio / Xamarin Studio
70+
71+
Before the `.sln` files will compile in Visual Studio or Xamarin Studio, the external dependencies need to be downloaded. This can be done by running the `build.sh` or `build.ps1` with the target `externals`. After the externals are setup, the `.sln` files should compile in an IDE.
72+
73+
74+
## License
75+
76+
The license for this repository is specified in
77+
[LICENSE.md](LICENSE.md)
78+
79+
The `externals` build task downloads some external dependencies from Google which are licensed under and subject to the terms of [Android Software Development Kit License Agreement](http://developer.android.com/sdk/terms.html)

SupportConsts.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
static class __SupportConsts {
2+
public const string Url = "https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip";
3+
public const string Version = "23.3.0.0";
4+
public const string AarVersion = "23.3.0";
5+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Animated Vector Drawable Android Support Library
2+
3+
4+
This library adds support for Animated Vector Drawables in older Android API Levels.
5+
6+
7+
8+
9+
## Android Support Libraries
10+
11+
The Android Support Libraries are a set of code libraries that provide backward-compatible versions of Android framework APIs as well as features that are only available through the library APIs. Each Support Library is backward-compatible to a specific Android API level. This design means that your applications can use the libraries' features and still be compatible with devices running older versions of Android.
12+
13+
Including the Support Libraries in your Android project is considered a best practice for application developers, depending on the range of platform versions your app is targeting and the APIs that it uses. Using the features the libraries provide can help you improve the look of your application, increase performance and broaden the reach of your application to more users.
14+
15+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Animated Vector Drawable Android Support Library
2+
3+
4+
This library adds support for Animated Vector Drawables in older Android API Levels.
5+
6+
7+
{GENERAL}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
2+
This library adds support for utilizing Vector drawable graphics on devices running Android API Level 11 or higher.
3+
4+
### Target SDK Version
5+
NOTE: Using this support library requires that your app have its Target Android Version (*targetSdkVersion*) set to Lollipop (5.0 - API Level 21) or higher, or you will have *aapt* related compile errors. You can still set the Target Framework which your app is compiled against as low as Android 4.0.3 (API Level 15).
6+
7+
8+
Using Animated Vector Drawables
9+
------
10+
11+
To use your vector drawable, you should also reference the **AppCompat v7 Support Library** in your app.
12+
13+
Your activity should derive from `AppCompatActivity` so that the `AppCompatImageView` is automatically used at runtime where you have defined `ImageView` types.
14+
15+
Here is an example of an animated vector. It is created by defining multiple resources.
16+
17+
1. Create a vector image by creating a file `Resources/drawable/vector.xml` with the contents:
18+
19+
```xml
20+
<?xml version="1.0" encoding="utf-8" ?>
21+
<vector
22+
xmlns:android="http://schemas.android.com/apk/res/android"
23+
android:height="64dp"
24+
android:width="64dp"
25+
android:viewportHeight="600"
26+
android:viewportWidth="600" >
27+
<group
28+
android:name="rotationGroup"
29+
android:pivotX="300.0"
30+
android:pivotY="300.0"
31+
android:rotation="45.0" >
32+
<path
33+
android:name="v"
34+
android:fillColor="#000000"
35+
android:pathData="M300,70 l 0,-70 70,70 0,0 -70,70z" />
36+
</group>
37+
</vector>
38+
39+
```
40+
41+
42+
43+
2. Create a file `Resources/anim/path_morph.xml` with the contents:
44+
45+
```xml
46+
<?xml version="1.0" encoding="UTF-8" ?>
47+
<set
48+
xmlns:android="http://schemas.android.com/apk/res/android">
49+
<objectAnimator
50+
android:duration="3000"
51+
android:propertyName="pathData"
52+
android:valueFrom="M300,70 l 0,-70 70,70 0,0 -70,70z"
53+
android:valueTo="M300,70 l 0,-70 70,0 0,140 -70,0 z"
54+
android:valueType="pathType"/>
55+
</set>
56+
```
57+
58+
59+
3. Create a file `Resources/anim/rotation.xml` with the contents:
60+
61+
```xml
62+
<?xml version="1.0" encoding="UTF-8" ?>
63+
<objectAnimator
64+
xmlns:android="http://schemas.android.com/apk/res/android"
65+
android:duration="6000"
66+
android:propertyName="rotation"
67+
android:valueFrom="0"
68+
android:valueTo="360" />
69+
```
70+
71+
72+
Finally, create an animated vector drawable file `Resources/anim/avd.xml` to tie the vector and animations together with the contents:
73+
74+
```xml
75+
<?xml version="1.0" encoding="UTF-8" ?>
76+
<animated-vector
77+
xmlns:android="http://schemas.android.com/apk/res/android"
78+
android:drawable="@drawable/vector" >
79+
<target
80+
android:name="rotationGroup"
81+
android:animation="@anim/rotation" />
82+
<target
83+
android:name="v"
84+
android:animation="@anim/path_morph" />
85+
</animated-vector>
86+
```
87+
88+
You can then reference your vector drawable programmatically, or declaratively in your android layout xml.
89+
90+
To use your vector drawable programmatically:
91+
92+
```csharp
93+
imageView.SetImageResource (Resource.Drawable.avd);
94+
```
95+
96+
To specify the vector in your layout file, use the `app:srcCompat` attribute (be sure to define the `xmlns:app` namespace as well):
97+
98+
```xml
99+
<?xml version="1.0" encoding="utf-8"?>
100+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
101+
xmlns:app="http://schemas.android.com/apk/res-auto"
102+
android:orientation="vertical"
103+
android:layout_width="match_parent"
104+
android:layout_height="match_parent">
105+
<ImageView
106+
app:srcCompat="@drawable/avd"
107+
android:layout_width="match_parent"
108+
android:layout_height="fill_parent"
109+
android:layout_weight="1"
110+
android:id="@+id/imageView" />
111+
</LinearLayout>
112+
```
113+
114+
Finally, you will need to start the animation from your code:
115+
116+
```csharp
117+
imageView.Drawable.JavaCast<Android.Graphics.Drawables.IAnimatable> ().Start ();
118+
```
119+
120+
121+
**NOTE:** The `Xamarin.Android.Support.Vector.Drawable` nuget package contains a .targets file which appends the argument `--no-version-vectors` to `AndroidResgenExtraArgs` build property value to ensure the parameter is passed to the `aapt` invocation.

0 commit comments

Comments
 (0)