Skip to content

praveensinghshekhawat/CornerLabelTextView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

44 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CornerLabelTextView

Codacy Badge License: Apache-2.0

A customizable Android TextView to show corner labels like SALE, NEW, etc. Easily add labels to your views without complex layouts. A fully customizable Corner Label TextView for Android β€” Add stylish corner labels to your TextViews with just a few XML attributes!


Preview

Screenshots

✨ Features

  • πŸ”Ή Add corner labels to TextViews
  • 🎨 Customize label text, size, color, background
  • ↔️ Choose between left or right corner
  • πŸͺΆ Lightweight, no heavy dependencies

πŸš€ Installation

πŸ“¦ Dependency

repositories { 
    mavenCentral()
}

➑️ Gradle (Groovy)

dependencies {
    implementation 'io.github.praveensinghshekhawat:cornerlabeltextview:1.0.2'
}

➑️ Gradle (Kotlin DSL)

dependencies {
    implementation("io.github.praveensinghshekhawat:cornerlabeltextview:1.0.2")
}

🧩 Usage

XML Example:

<io.github.praveensinghshekhawat.CornerLabelTextview
    android:id="@+id/txt1"
    android:layout_height="100dp"
    android:layout_width="100dp"
    app:cornerLabelBackgroundColor="@color/black"
    app:cornerLabelLength="30dp" 
    app:cornerLabelMode="left"
    app:cornerLabelText="CornerLabel" 
    app:cornerLabelTextColor="@color/white"
    app:cornerLabelTextSize="10sp" />

Java Example:

CornerLabelTextview stv = (CornerLabelTextview) findViewById(R.id.txt1);
        stv.setText("CornerLabel")
                .setTextColor(Color.WHITE)
                .setCornerLabelBackgroundColor(Color.BLACK)
                .setTextSize(18)
                .setCornerLabelLength(50)
                .setMode(CornerLabelTextview.LabelMode.MODE_LEFT);

πŸ”§ Custom Attributes:

Attribute Description
cornerLabelText Text inside the label
cornerLabelTextSize Size of label text
cornerLabelTextColor Label text color
cornerLabelBackgroundColor Label background color
cornerLabelLength Length of the label (in dp)
cornerLabelMode left,left_bottom,
right,right_bottom,
left_triangle,left_bottom_triangle,
right_triangle,right_bottom_triangle

βš™οΈ Requirements

  • minSdkVersion: 24
  • compileSdkVersion: 34
  • Java: 11 or above

️ πŸ’» Developer/Author

πŸ™‹β€ Praveen Singh Shekhawat
πŸ“§ [email protected]
πŸ™ GitHub Profile
πŸ”— LinkedIn Profile

β˜• Support Me

If you found this library helpful, consider buying me a coffee πŸ’›
"Buy Me A Coffee"

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

About

A customizable πŸš€ Android TextView to show corner labels like SALE, NEW, etc.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages