a solution that can help developers display pictures in any shape.

Overview

Download

android-anyshape

With the solution, pictures can be displayed in any shape on Android platform.

Effect

The left is the UI using normal ImageViews, and the right is UI using the AnyshapeImageViews

All we need to make are 3 mask PNGs like below (the background must be transparent):

minSdkVersion

11

Dependencies

latest version

see it as an icon in the beginning of the README file.

gradle

compile 'cn.lankton:anyshape:latest version'

maven

<dependency>
  <groupId>cn.lankton</groupId>
  <artifactId>anyshape</artifactId>
  <version>latest version</version>
  <type>pom</type>
</dependency>

Usage

You can use the AnyshapeImageView like below in your layout file:

<cn.lankton.anyshape.AnyshapeImageView
    android:layout_width="150dp"
    android:layout_height="150dp"
    android:layout_marginTop="20dp"
    android:src="@drawable/kumamon"
    app:anyshapeMask="@drawable/singlestar"/>

You can use the attribue "anyshapeMask" to set the mask. AnyshapeImageView can get the path from the mask, by detecting the alpha value of every pixel.

if you want to create a view with pure color , you can use the code like this:

<cn.lankton.anyshape.AnyshapeImageView
    android:layout_width="210dp"
    android:layout_height="140dp"
    android:layout_marginTop="20dp"
    app:anyshapeBackColor="@android:color/holo_red_light"
    app:anyshapeMask="@drawable/rings"/>

If you want to change the pure color dynamically, do like this:

anyshapeImageView.setBackColor(Color.Green);

summary

The code is not hard for anybody to understand. Just hope that it can provide some help or inspiration for you.

You might also like...
Kotlin Multiplatform Mobile demo for Android and iOS - app for viewing Cat pictures
Kotlin Multiplatform Mobile demo for Android and iOS - app for viewing Cat pictures

CatViewerDemo Android demo iOS demo Kotlin Multiplatform Mobile demo for Android and iOS. App for viewing Cat pictures from Cats API. This sample show

An app that displays dog pictures and info because who doesn't love dogs?
An app that displays dog pictures and info because who doesn't love dogs?

🐩 🐩 🐩 Dogtionary 🐩 🐩 🐩 The Basics An app that displays dog pictures and info because who doesn't love dogs? Tech Kotlin 1.5.21 Gradle 7.0.0 Buil

This Andoird project is about classifying garbage pictures using a CNN-based Tensorflowlite model and fetching location using GPS to mark its area on the map.
This Andoird project is about classifying garbage pictures using a CNN-based Tensorflowlite model and fetching location using GPS to mark its area on the map.

Grbage_Detector_And_Locator Description As per some of the recent reports published, in India, the pollution levels are increasing at a colossal pace

The simplest version of a notepad application with the feature to save pictures on a note.

PhotoNotePad Easy to write, read and organize notes with photo(s). Feature A note has... title content date color pin images Easy to write a note. Pro

load-the-image Apply to compose-jb(desktop), Used to load network and local pictures.

load-the-image load-the-image Apply to compose-jb(desktop), Used to load network and local pictures. 🚀 Under construction It may change incompatibly

🕹️ See how the properties of Android's
🕹️ See how the properties of Android's "shape" affect the Drawable's appearance, intuitively.

GradientDrawableTuner English | 中文 Get confusing about the drawable in Android? Try playing with GradientDrawableTuner! With the GradientDrawableTuner

Dynamic Speedometer and Gauge for Android. amazing, powerful, and multi shape :zap:
Dynamic Speedometer and Gauge for Android. amazing, powerful, and multi shape :zap:

SpeedView Dynamic Speedometer, Gauge for Android. amazing, powerful, and multi shape ⚡ , you can change (colors, bar width, shape, text, font ...every

Custom ImageView for android with polygon shape (Android)
Custom ImageView for android with polygon shape (Android)

PolygonImageView Create a custom ImageView with polygonal forms. Usage To use PolygonImageView, add the module into your project and start to build xm

Progress Bar in the shape of regular polygon.
Progress Bar in the shape of regular polygon.

N-SidedProgressBar Progress Bar in the shape of regular polygon. Download The library is available on jcenter. Just add the dependency to your build.g

Dynamic Speedometer and Gauge for Android. amazing, powerful, and multi shape :zap:
Dynamic Speedometer and Gauge for Android. amazing, powerful, and multi shape :zap:

SpeedView Dynamic Speedometer, Gauge for Android. amazing, powerful, and multi shape ⚡ , you can change (colors, bar width, shape, text, font ...every

High level parsing to ensure your input is in the right shape and satisfies all constraints that business logic requires.

Parsix High level parsing to ensure your input is in the right shape and satisfies all constraints that business logic requires. It is highly inspired

RoundedStarShape and Polygon Shape for Jetpack compose
RoundedStarShape and Polygon Shape for Jetpack compose

Rounded star shape and polygon shape for Jetpack Compose How to install copy compose-polygonshape directory to your project directory. Add entry compo

📲  Android Application to track any user activity on Github built using the Github Developers API. Used Retrofit to fetch data and MVVM Architecture.
📲 Android Application to track any user activity on Github built using the Github Developers API. Used Retrofit to fetch data and MVVM Architecture.

Github Visualizer 📲 Android Application to track any user activity on Github built using the Github Developers Api. A sample application to demonstra

Changelog - a android library, it helps developers display the history of changes in their applications
Changelog - a android library, it helps developers display the history of changes in their applications

Changelog is a android library, it helps developers display the history of changes in their applications. Supports Locales, Layout direction

Some beautiful android loading drawable, can be combined with any view as the LoadingView or the ProgressBar. Besides, some Drawable can customize the loading progress too.
Some beautiful android loading drawable, can be combined with any view as the LoadingView or the ProgressBar. Besides, some Drawable can customize the loading progress too.

LoadingDrawable: Android cool animation collection 前言 CircleRotate源码解析 Fish源码解析 LoadingDrawable is some android animations implement of drawable: a li

An library to help android developers working easly with activities and fragments (Kotlin version)
An library to help android developers working easly with activities and fragments (Kotlin version)

AFM An library to help android developer working easly with activities and fragments (Kotlin) Motivation Accelerate the process and abstract the logic

An library to help android developers working easly with activities and fragments (Kotlin version)
An library to help android developers working easly with activities and fragments (Kotlin version)

AFM An library to help android developer working easly with activities and fragments (Kotlin) Motivation Accelerate the process and abstract the logic

a set of Settings like composable items to help android Jetpack Compose developers build complex settings screens
a set of Settings like composable items to help android Jetpack Compose developers build complex settings screens

This library provides a set of Settings like composable items to help android Jetpack Compose developers build complex settings screens without all the boilerplate

Linkester is an Android library that aims to help Android developers test their deep links implementation.
Linkester is an Android library that aims to help Android developers test their deep links implementation.

Linkester Linkester is an Android library that aims to help Android developers test their deep links implementation. The idea is to have a new launche

Comments
  • can't move image in imageview

    can't move image in imageview

    I was using your library and i found this very useful . I am making an app where i want to add a functionality for drag ,zoom image within the imageview . I have tried to implement that functionality but couldn't help myself . I was wondering if you could do something

    opened by bandhiwal 0
Owner
Lankton
never miss
Lankton
🍂 Jetpack Compose image loading library which can fetch and display network images using Glide, Coil, and Fresco.

?? Jetpack Compose image loading library which can fetch and display network images using Glide, Coil, and Fresco.

Jaewoong Eum 1.4k Jan 2, 2023
ComposeImageBlurhash is a Jetpack Compose component with the necessary implementation to display a blurred image

compose-image-blurhash ComposeImageBlurhash is a Jetpack Compose component with the necessary implementation to display a blurred image while the real

Orlando Novas Rodriguez 24 Nov 18, 2022
An Android view for displaying repeated continuous side scrolling images. This can be used to create a parallax animation effect.

Scrolling Image View An Android view for displaying repeated continuous side scrolling images. This can be used to create a parallax animation effect.

Q42 1.8k Dec 27, 2022
An imageView can auto scroll with device rotating.

PanoramaImageView An imageView can auto scroll with device rotating. ScreenShots Include PanoramaImageView to Your Project With gradle: dependencies {

郭佳哲 2.2k Dec 26, 2022
BlackDex is an Android unpack tool, it supports Android 5.0~12 and need not rely to any environment. BlackDex can run on any Android mobile phones or emulators, you can unpack APK File in several seconds.

BlackDex is an Android unpack tool, it supports Android 5.0~12 and need not rely to any environment. BlackDex can run on any Android mobile phones or emulators, you can unpack APK File in several seconds.

null 4.3k Jan 2, 2023
malik dawar 87 Sep 18, 2022
🔥The Android Startup library provides a straightforward, performant way to initialize components at the application startup. Both library developers and app developers can use Android Startup to streamline startup sequences and explicitly set the order of initialization.

??The Android Startup library provides a straightforward, performant way to initialize components at the application startup. Both library developers and app developers can use Android Startup to streamline startup sequences and explicitly set the order of initialization.

Rouse 1.3k Dec 30, 2022
Subclass of ImageView that 'morphs' into a circle shape and can rotates. Useful to be used as album cover in Music apps. :dvd::notes:

Music Cover View A Subclass of ImageView that 'morphs' into a circle shape and can rotates. Useful to be used as album cover in Music apps. It's used

André Mion 254 Dec 23, 2022
📸 Use Android camera to take pictures and videos, based on `camera2` api.

Camera Use Android camera to take pictures and videos, based on camera2 api. Features Auto filled CameraView for previewing Support both image capture

Hong Duan 119 Nov 25, 2022
Android application to slice and share your pictures

Piclice A practical tool which helps users to slice and share their pictures. Features Displaying all pictures of system Gallery Slicing and resizing

Navid 182 Nov 22, 2022