Amri.CircularImageView.Binding
1.0.0
dotnet add package Amri.CircularImageView.Binding --version 1.0.0
NuGet\Install-Package Amri.CircularImageView.Binding -Version 1.0.0
<PackageReference Include="Amri.CircularImageView.Binding" Version="1.0.0" />
<PackageVersion Include="Amri.CircularImageView.Binding" Version="1.0.0" />
<PackageReference Include="Amri.CircularImageView.Binding" />
paket add Amri.CircularImageView.Binding --version 1.0.0
#r "nuget: Amri.CircularImageView.Binding, 1.0.0"
#:package Amri.CircularImageView.Binding@1.0.0
#addin nuget:?package=Amri.CircularImageView.Binding&version=1.0.0
#tool nuget:?package=Amri.CircularImageView.Binding&version=1.0.0
CircularImageView .NET Android Binding
A modern .NET 10 Android binding library for CircularImageView with full XML attribute support, clean API, and AndroidX compatibility. Perfect for .NET Android and .NET MAUI applications.
Features
✅ Circular ImageView - Display images in perfect circles
✅ Customizable Borders - Set border width and color with full control
✅ Shadow Support - Add shadows with configurable radius and color
✅ Background Color - Set circle background color independently
✅ AndroidX Compatible - Fully compatible with modern AndroidX libraries
✅ MAUI Ready - Works seamlessly in .NET MAUI projects
✅ Strongly-Typed API - Clean, idiomatic .NET API with full IntelliSense support
✅ Extension Methods - Convenient helpers for common operations
Installation
NuGet Package Manager
Install-Package Amri.CircularImageView.Binding
.NET CLI
dotnet add package Amri.CircularImageView.Binding
PackageReference
<PackageReference Include="Amri.CircularImageView.Binding" Version="1.0.0" />
Usage
XML Layout
Add the CircularImageView to your Android XML layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<com.amri.circularimageview.CircularImageView
android:id="@+id/profileImage"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/profile_photo"
app:civ_border_width="4dp"
app:civ_border_color="#FFFFFF"
app:civ_shadow_radius="4"
app:civ_circle_background_color="#FF0000" />
</LinearLayout>
C# Code
Use the CircularImageView in your C# code:
using Com.Amri.CircularImageView;
using Com.Amri.CircularImageView.Extensions;
using Android.Graphics;
// Find the view
var circularImageView = FindViewById<CircularImageView>(Resource.Id.profileImage);
// Set properties programmatically
circularImageView.BorderWidth = 8f;
circularImageView.BorderColor = Color.White.ToArgb();
circularImageView.ShadowRadius = 10f;
circularImageView.CircleBackgroundColor = Color.ParseColor("#FF5722").ToArgb();
// Or use extension methods for convenience
circularImageView.SetBorderColor(Color.Blue);
circularImageView.SetBorderWidthDp(4f); // Automatically converts dp to pixels
circularImageView.SetShadowRadiusDp(6f);
circularImageView.SetCircleBackgroundColor(Color.Transparent);
// Load image from URL (using your preferred image loading library)
// Example with Glide or similar:
// Glide.With(this).Load(imageUrl).Into(circularImageView);
.NET MAUI Integration
In your .NET MAUI Android project:
using Com.Amri.CircularImageView;
using Microsoft.Maui.Platform;
// In your handler or platform-specific code
var circularImageView = new CircularImageView(context);
circularImageView.SetBorderWidthDp(3f);
circularImageView.SetBorderColor(Android.Graphics.Color.White);
Available XML Attributes
| Attribute | Type | Description |
|---|---|---|
app:civ_border_width |
dimension | Border width in dp/px |
app:civ_border_color |
color | Border color |
app:civ_circle_background_color |
color | Background color of the circle |
app:civ_shadow_radius |
float | Shadow blur radius |
app:civ_shadow_color |
color | Shadow color |
Available Properties
| Property | Type | Description |
|---|---|---|
BorderWidth |
float | Gets/sets the border width in pixels |
BorderColor |
int/Color | Gets/sets the border color |
CircleBackgroundColor |
int/Color | Gets/sets the circle background color |
ShadowRadius |
float | Gets/sets the shadow radius |
ShadowColor |
int/Color | Gets/sets the shadow color |
Extension Methods
The library includes helpful extension methods in Com.Amri.CircularImageView.Extensions:
SetBorderColor(Color color)- Set border color using Color objectSetBorderColorArgb(int argb)- Set border color using ARGB intSetCircleBackgroundColor(Color color)- Set background colorSetBorderWidthDp(float widthDp)- Set border width in dp (auto-converts to px)SetShadowRadiusDp(float radiusDp)- Set shadow radius in dp (auto-converts to px)
Requirements
- .NET 10 or later
- Android API 21+ (Android 5.0 Lollipop)
- AndroidX libraries
Migration from Xamarin
If you're migrating from Xamarin.Android:
- Update to .NET 10:
<TargetFramework>net10.0-android</TargetFramework> - Replace old package references with this binding
- Update namespace imports to
Com.Amri.CircularImageView - No code changes needed - API is fully compatible!
Performance Tips
- Reuse CircularImageView instances when possible
- Use appropriate image sizes to avoid unnecessary scaling
- Consider using image loading libraries (Glide, Coil) for better performance
- The view properly implements disposal patterns for native resources
Troubleshooting
Border not showing
Ensure you've set both BorderWidth and BorderColor:
circularImageView.BorderWidth = 4f;
circularImageView.BorderColor = Color.White;
Image appears stretched
Make sure layout_width and layout_height are equal for perfect circles:
android:layout_width="100dp"
android:layout_height="100dp"
Shadow not visible
Shadows require sufficient padding around the view:
android:layout_margin="8dp"
License
This binding library is released under the MIT License. See LICENSE for details.
The original CircularImageView library may have its own license. Please refer to the original library's documentation.
Support
Changelog
Version 1.0.0
- Initial release
- .NET 10 Android binding
- Full XML attribute support
- Extension methods for idiomatic .NET API
- AndroidX compatibility
- Complete documentation
Made with ❤️ for the .NET Android and MAUI community
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-android36.0 is compatible. |
-
net10.0-android36.0
- Xamarin.AndroidX.AppCompat (>= 1.7.1.1)
- Xamarin.Kotlin.StdLib (>= 2.2.21)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|