Giter Club home page Giter Club logo

roundimageview's Introduction

Round Corners ImageView

An awesome and lightweight library for android (java/kotlin) for getting ImageViews in rounded corners or circular shapes with CUSTOM RIPPLE COLORS, BORDER COLORS and ROUNDNESS Dimension.

You can even put other views or viewgroups inside it.

ScreenShot 1

ScreenShot 2

ScreenShot 3

Usage

Add it in your root build.gradle at the end of repositories:

allprojects {
		repositories {
			maven { url 'https://jitpack.io' }
		}
	} 

Add the dependency

dependencies {
	        implementation 'com.github.Nasib555:RoundImageView:master-SNAPSHOT'
	}

Add this view in your xml


<com.nasibhaider.roundimageview.RoundCornersImageView
        android:id="@+id/round_imageview"
        android:layout_width="250dp"
        android:layout_height="250dp"
        app:cardElevation="8dp"
        app:rippleColor="#000"
        app:roundness="250dp"
        app:src="@drawable/img_logo"
        app:strokeColor="#000"
        app:strokeWidth="7dp"/>

Views Inside this imageview

You can add any viewgroup or view inside it, as this view extends android design library's CardView

<com.nasibhaider.roundimageview.RoundCornersImageView
        android:id="@+id/corners"
        android:layout_width="250dp"
        android:layout_height="250dp"
        app:cardElevation="8dp"
        app:rippleColor="#000"
        app:roundness="250dp"
        app:src="@drawable/img_logo"
        app:strokeColor="#000"
        app:strokeWidth="0dp">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:background="#9E000000"
            android:padding="10dp"
            android:textSize="25dp"
            android:gravity="center_horizontal"
                android:text="Claire Z."
            android:textColor="#fff" />
    </com.nasibhaider.roundimageview.RoundCornersImageView>

Java usage

You can do pretty much anything as you'd with a normal imageview but, there's some points you need to keep in mind.

As this this extends CardView and not an ImageView, you cannot cast it to an ImageView, if you want to cast it to an ImageView you'd do something like

ImageView imageView=riv.getImageView();
// now you can call all methods of imageview on this ```

> If you do not want to cast it, you can directly call methods of ImageView on it like
RoundCornersImageView riv=findViewById(R.id.round_image_view);
riv.getImageView.setImageResource(R.drawable.dp);

Kotlin usage

Pretty much the same.

var ivRound: RoundCornersImageView? = findViewById(R.id.round_image_view)

//direct properties
ivRound?.strokeWidth =10f
ivRound?.roundness = 10f
ivRound?.rippleColor = Color.RED
ivRound?.strokeColor = Color.RED

//indirect properties
ivRound?.imageview.setImageResource(R.drawable.dp)
ivRound?.imageview.setBitmap(bitmap)
//and all other properties of imageview

roundimageview's People

Contributors

nasib555 avatar

Stargazers

 avatar

Watchers

 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.