A customizable Android ShapeableImageView to easily display country flags with different shapes and rounded corners.
Published via JitPack.
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven(url = "https://jitpack.io")
}
}dependencies {
implementation("com.github.haqt2003:flagimageview:1.0.0")
}<com.haqt.flagimageview.FlagImageView
android:id="@+id/fiv_flag"
android:layout_width="100dp"
android:layout_height="wrap_content"
app:countryCode="us"
app:shape="rectangle"
app:cornerRadius="8dp"/>val flagView = findViewById<FlagImageView>(R.id.fiv_flag)
// Change country dynamically
flagView.countryCode = "jp" // Japan
// Change shape
flagView.shape = FlagImageView.Shape.SQUARE
// Change corner radius
flagView.cornerRadius = 12f| Attribute | Type | Example | Description |
|---|---|---|---|
countryCode |
String | "us", "US" |
ISO country code. Example: "us", "US", "vn", "VN". |
shape |
Enum | "square" or "rectangle" |
Defines flag aspect ratio (1x1 or 4x3). |
cornerRadius |
Dimen | "8dp" |
Rounded corner radius. If too large, automatically adjusts to max (circle/pill). |
| Square Flag | Rectangular Flag | Rounded Corners |
|---|---|---|
![]() |
![]() |
![]() |
MIT License


