📻 ImageRadioButtonAndroid is a light library for custom radio button with image functionality. You can easily add image to radio button. Integration is very easy.
Add the maven library bucket to the dependencyResolutionManagement.repositories
block in settings.gradle.kts
file as follows:
dependencyResolutionManagement {
...
repositories {
...
maven("https://jitpack.io")
}
}
Install the library to the project in desired module's build.gradle.kts
file. Replace <current_version>
with the actual version:
implementation("com.github.raheemadamboev:image-radio-button-android:<current_version>")
Add GravityRadioGroup to your XML layout:
<xyz.teamgravity.imageradiobutton.GravityRadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
Add GravityImageRadioButton inside the GravityRadioGroup and set required attributes below:
<xyz.teamgravity.imageradiobutton.GravityRadioGroup
...
>
<xyz.teamgravity.imageradiobutton.GravityImageRadioButton
android:id="@+id/android_b"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="20dp"
app:girbImage="@drawable/android"
app:girbPressedTextColor="@color/white"
app:girbText="Android"
app:girbUnpressedTextColor="?attr/colorPrimary" />
</xyz.teamgravity.imageradiobutton.GravityRadioGroup>
Attribute | Type | Usage |
---|---|---|
app:girbText |
string | String to display |
app:girbUnpressedTextColor |
color | Color of text when radio button is unpressed/unchecked |
app:girbPressedTextColor |
color | Color of text when radio button is pressed/checked |
app:girbImage |
drawable | Image drawable to display |
app:girbUnpressedImageTint |
color | Tint color of image when radio button is unpressed/unchecked |
app:girbPressedImageTint |
color | Tint color of image when radio button is pressed/checked |
app:girbPressedBackgroundDrawable |
drawable | Background drawable when radio button is pressed/checked |
If you don't want to set tint to ImageView of RadioButton, just don't set app:girbUnpressedImageTint
and app:girbPressedImageTint
attributes in XML!
Programming pictures are placed with the help of this library in this demo application. When radio button is clicked, its text gets shown via Toast.
GoTest 250 000+ downloads in Google Play Store
Buxgalteriya schyotlar rejasi 50 000+ downloads in Google Play Store
Irregular Verbs 25 000+ downloads in Google Play Store
Designed and developed by raheemadamboev (Raheem) 2022.
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.