A custom view for rating which easy to make and use, but function is excellent

Overview

ic_star_selected QRatingView

A custom view for rating which easy to make and use, but function is excellent

Effect Picture

Screenshot_20211203-144523

Properties

    <declare-styleable name="QRatingView">
        <!-- 未选中图片 -->
        <attr name="normalIcon" format="reference"/>
        <!-- 选中图片 -->
        <attr name="selectedIcon" format="reference"/>
        <!-- 自定义评分数量 -->
        <attr name="totalCount" format="integer"/>
        <!-- 选中的个数 -->
        <attr name="selectedCount" format="integer"/>
        <!-- 图案的间隙 -->
        <attr name="gap" format="dimension"/> // Default Size is 5dp
        <!-- 图案的大小 -->
        <attr name="iconSize" format="dimension"/> // Default Size is 25dp
        <!-- 是否可用 不可用时用于仅展示 -->
        <attr name="available" format="boolean"/> // Default value is true
    </declare-styleable>

Usage

for displaying

You are supposed to set tow properties, available and selectedCount. And available should be set as false. you can use it in .xml

    <com.yeqingqing.qratingview.QRatingView
        android:id="@+id/main_qrv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:available="false" // if just for displaying ,there are should be false
        app:iconSize="40dp"
        app:selectedCount="3"
        app:totalCount="5" />

also it also will be work in java

   main_qrv2.available = false
   main_qrv2.selectedCount = 5
   

for rating

In this case, we need to set totalCount in .xml and add A selected Lisntener for result

    <com.yeqingqing.qratingview.QRatingView
        android:id="@+id/qrv_main3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:iconSize="40dp" 
        app:totalCount="5" />
     findViewById<QRatingView>(R.id.qrv_main3).setOnSelectedListener(object :
            QRatingView.OnSelectedListener {
            override fun onSelected(selectedCount: Int) {
                when (selectedCount) {
                //todo any reaction for rating
                    1 -> commence1.text = "很差"
                    2 -> commence1.text = "有待改进"
                    3 -> commence1.text = "还行"
                    4 -> commence1.text = "不错"
                    5 -> commence1.text = "非常可以"
                }
            }

        })

About Me

blog : QCoder
email: [email protected]

You might also like...
A custom OTP view to enter a code usually used in authentication
A custom OTP view to enter a code usually used in authentication

A custom view to enter a code usually used in authentication. Different types of OTPViews. Easy to use and configure your own view and character of OTP using all the attributes.

Katoot - An easy-to-use (blocking) Kotlin wrapper for Kahoot's REST api

katoot An easy-to-use (blocking) Kotlin wrapper for Kahoot's REST api. Usage Qui

A learning project which focuses on designing an OTP flow and use of various components of Android efficiently
A learning project which focuses on designing an OTP flow and use of various components of Android efficiently

Otp Demo A learning project which focuses on designing an OTP flow using Firebase. Article: https://saurabhpant.medium.com/otp-login-using-firebase-hi

A webapp which generates a simple Discord profile banner image in real-time which shows user's status and activity.

DiscordProfileBanner This tool generates a Discord profile banner image in realtime. I wrote it for use in my AniList profile. An example in action: H

A basic library that enables easy composition of gesture sequence recognition on a view

GestureSequence A basic library that enables easy composition of gesture sequence recognition on a view. Basic API looks like: // Perform action() whe

Learn how to make an app designed for single-screen devices shine when running on foldable and dual-screen devices

dcberlin21-workshop Make your app shine om foldable devices with the samples we have here. Related links SDK open-source code SDK samples (Kotlin) App

Bukkit library written in Kotlin to make with compatibility and ease non-playable-character (NPC)

mc-npk Easy to use, fast and efficient library to make non-playable-characters (

This library is created to make files uploading and downloading on Aws easier

S3Manager - aws files uploading library This library is created to make files uploading and downloading on Aws easier Features Easy to use Single/mult

SeatBookView is an Android Studio Library that helps to make it easier to create Bus, Train, Cinema Theater Seat UI and all functionalities are given.
SeatBookView is an Android Studio Library that helps to make it easier to create Bus, Train, Cinema Theater Seat UI and all functionalities are given.

SeatBookView SeatBookView is an Android Studio Library that helps to make it easier to create Bus 🚍 , Train 🚉 , Cinema Theater Seat UI and all funct

Owner
QCoder
struggling for freedom
QCoder
Lambë Language 7 Dec 21, 2022
FizzBuzzKotlin - A function fizzBuzz to generate a list of string based on the input number

FizzBuzzKotlin write a function fizzBuzz to generate a list of string based on t

gson 0 Feb 12, 2022
Kotlin extension function provides a facility to "add" methods to class without inheriting a class or using any type of design pattern

What is Kotlin Extension Function ? Kotlin extension function provides a facility to "add" methods to class without inheriting a class or using any ty

mohsen 21 Dec 3, 2022
This project is basically PowerNukkit but just in Kotlin (check out the original PowerNukkit source here: https://github.com/PowerNukkit/PowerNukkit)

Introduction Nukkit is nuclear-powered server software for Minecraft: Pocket Edition. It has a few key advantages over other server software: Written

Chrones 5 Jul 7, 2021
Swarup 2 Feb 6, 2022
Alternative to DreamStorageService, but instead of storing files on a database, it is stored on the file system itself.

EtherealGambi Alternative to DreamStorageService, but instead of storing files on a database, it is stored on the file system itself. I made this beca

null 1 Jun 2, 2022
Candroid Browser is a replacement web browser for Candroid. It is designed to replace the AOSP browser, but not Google Chrome. It will be based on a privacy friendly WebKit engine fork.

Candroid Browser Candroid Browser is a replacement web browser for Candroid. It is designed to replace the AOSP browser, but not Google Chrome. It wil

Sean P. Myrick V19.1.7.2 3 Dec 22, 2022
Amazing and easy to use Accordion Library for Android built with kotlin

AccoLib An easy-to-use, amazing Accordion Library for Android built with kotlin. It reduces the amount of code needed to make Accordions in android, w

Gourav Khunger 6 Jul 4, 2022
Android Custom View Accessibility

CustomFanController - Solution Code Creates a circular fan control dial that offers multiple selections marked by numeric indicators: 0 for off, 1 for

Atıl Samancıoğlu 7 Dec 28, 2022