Skip to content

DamonQu/CircleTextImageViewDemo

Repository files navigation

CircleImageView

Description

This is an Android Image View extention which can help to create circle image view with

  1. Border (border width, border color)

  2. Center Text (change Text Color, Size, etc)

  3. Bottom Text (bottom text lable with specified background color (change text size, text color, background color, etc)

    ScreenShoot

Attributes for CircleTextImageView

Atrribute Description Equals
ctiv_border_width define the border width setBorderWidth(int borderWidth)
ctiv_border_color define the border color setBorderColor(@ColorInt int borderColor)
ctiv_border_overlay if allow border overlay setBorderOverlay(boolean borderOverlay)
ctiv_circle_background_color define the circle background color setCircleBackgroundColor(@ColorInt int circleBackgroundColor)
ctiv_center_text_color define center text color setCenterTextColor(@ColorInt int textColor)
ctiv_center_text_size define center text size setCenterTextSize(int sp)
ctiv_center_text define center text content setCenterText(String content)
ctiv_center_text_offset define the offset to the center of the circle setCenterTextOffset(int offset)
ctiv_bottom_text_color define the bottom text color setBottomTextColor(@ColorInt int textColor)
ctiv_bottom_text_size define the bottom text size setBottomTextSize(int sp)
ctiv_bottom_text_background define the background color for text label setBottomBackgroundColor(@ColorInt int backgroundColor)
ctiv_bottom_text define the bottom text content setBottomText(String content)
ctiv_bottom_text_paddingTopBottom define the top/bottom padding for text label setmBottomTextPaddingTopBottom(int padding)

Usage

Gradle:

compile 'cn.tenmaxtech:CircleTextImageView:1.0.2'

Maven:

<dependency>
  <groupId>cn.tenmaxtech</groupId>
  <artifactId>CircleTextImageView</artifactId>
  <version>1.0.2</version>
  <type>pom</type>
</dependency>

Ivy

<dependency org='cn.tenmaxtech' name='CircleTextImageView' rev='1.0.2'>
  <artifact name='CircleTextImageView' ext='pom' ></artifact>
</dependency>

XML

<cn.tenmaxtech.circletextimageview.CircleTextImageView
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:src="@mipmap/ic_launcher"
        app:ctiv_border_color="@android:color/holo_red_dark"
        app:ctiv_border_width="2dp"
        app:ctiv_bottom_text="words"
        app:ctiv_bottom_text_size="13sp"
        app:ctiv_bottom_text_background="@android:color/darker_gray"
        app:ctiv_bottom_text_paddingTopBottom="10dp"/>

TODO

  • use StaticLayout to handle multiple lines text for both center text and bottom text
  • implement Text-related configuration (TextAligment/Font/etc) for both center text and bottom text

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages