RotateLabelView

This is library to help you to add a sticky rotation label into your view.

Import into your project

implementation 'com.qifan.rotateLabelView:rotateLabelView:1.0.0'

ScreenShots

1

2

3

4

Example Usage

 <com.qifan.library.RotateLabelView
        android:id="@+id/rotate_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@android:color/transparent"
        app:background_color="@color/colorAccent"
        app:label="Android"
        app:layout_constraintEnd_toEndOf="@id/image"
        app:layout_constraintTop_toTopOf="@id/image"
        app:text_color="@android:color/white"
        app:text_size="15sp" />

Custom Attributes

attr type default meaning
label string NONE label content text
text_color color android.R.color.white label color
background_color color android.R.color.black label background color
text_size dimension 30f label text size
rotation_angle integer 45 label rotation angle
type enum TOP_RIGHT label rotation position(TOP_RIGHT,TOP_LEFT,BOTTOM_RIGHT,BOTTOM_LEFT)

Available Setter Attrs Function

interface RotateLabelComponent {
    fun setLabel(text: Label)
    fun setLabel(@StringRes textRes: Int)
    fun setBackgroundColor(@ColorRes color: Int)
    fun setTextColor(@ColorRes color: Int)
    fun setTextSize(textSize: Float)
    fun setType(type: RotateLabelView.Type)
}

GitHub