Git Product home page Git Product logo

shapedbackgroundandroid's Introduction

ShapedBackground

Repo for the Instagram-like shaped background on Android


We are a development agency building phenomenal apps.



Version License API API

Overview

ShapedBackground is an easy way to colour your backdrop as in Instagram stories

Android View

text.roundedBackground {
    backgroundColor = getColor(R.color.serenade)
    shadow {
        dx = 5f
        dy = 5f
        radius = 10f
    }
}

You can also add a gradient and set the background parameters

binding.text.roundedBackground {
    gradient = arrayListOf(Color.MAGENTA,Color.CYAN)
    cornerRadius = 40f
    paddingVertical = 5f
    paddingHorizontal = 5f
}

The ShapedBackground drawable uses View paddings to draw. You need to specify paddings to make the background drawable rendered without cropping:

android:padding="@dimen/your_padding"


In addition to TextView, you can also use the ShapedBackground for EditText

Jetpack Compose

RoundedBackgroundText(
    value = text,
    backgroundParams = BackgroundParams(
        paddingHorizontal = 15.dp,
        paddingVertical = 15.dp,
        cornerRadius = 15.dp,
        backgroundColor = Zeus,
        shadow = ShadowParams(
            dx = 2.dp,
            dy = 2.dp,
            radius = 1.dp
        )
    )
)

A gradient can be set instead of a solid background colour:

backgroundParams = BackgroundParams(
    gradient = arrayListOf(Color.Black, Color.Blue)
)

Download

  1. Add the repository
repositories {
	...
	maven { url 'https://jitpack.io' }
}
  1. Add the dependency:

Android View

implementation 'com.github.exyte.ShapedBackgroundAndroid:shapedbackground:1.1.1'

Jetpack Compose

implementation 'com.github.exyte.ShapedBackgroundAndroid:shapedbackgroundcompose:1.1.1'

Requirements

Android View: Min SDK 17+

Jetpack Compose: Min SDK 21+

shapedbackgroundandroid's People

Contributors

alexyudenkov avatar pinok-kio avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.