Giter Site home page Giter Site logo

android-badgedimageview's Introduction

Android BadgedImageView

Screenshot

Easily add badges to an ImageView to describe its content.

Recently, in Talon for Twitter, one of my challenges was that you couldn't tell if media was a GIF, video, YouTube, etc. All the images just had the generic play button on them. This library, based off of Plaid, was my way to fix that.

Google+ uses a very similar style in their own app.

Features

Place a badge over the top of the ImageView to describe its content.

  • Use any text you like
  • Change the badge color
  • Change the placement of the badge using Gravity
  • Change the padding on the badge

Installation

There are two ways to use this library:

As a Gradle dependency

This is the preferred way. Simply add:

dependencies {
    compile 'com.klinkerapps:badged_imageview:1.0.5'
}

to your project dependencies and run ./gradlew build or ./gradlew assemble.

As a library project

Download the source code and import it as a library project in Eclipse. The project is available in the folder library. For more information on how to do this, read here.

Example Usage

Functionality can be found in the example's MainActivity. Badges on BadgedImageView can be added (or changed) from code:

badgedIv.setBadge("YouTube", Color.RED);
badgedIv.setBadge("GIF"); // default badge color is white

or they can be defined in XML layout:

<com.klinker.android.badged_imageview.BadgedImageView
    android:id="@+id/badged_iv"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    android:src="@drawable/gif"
    android:layout_margin="12dp"
    android:scaleType="centerCrop"
    app:badgeGravity="start|bottom"
    app:badgePadding="12dp"
    app:badgeColor="@android:color/white"
    app:badgeText="GIF" />

Contributing

Please fork this repository and contribute back using pull requests. Features can be requested using issues. All code, comments, and critiques are greatly appreciated.

Changelog

The full changelog for the library can be found here.

License

Copyright 2016 Luke Klinker

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

android-badgedimageview's People

Contributors

klinker24 avatar klinker41 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

android-badgedimageview's Issues

RecyclerView Display Error

My RecyclerView has many ImageViews to display image,Some are gif.But some are not gif,and aslo display the gif tag text,how to clearn the tag text in the adapter?

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.