techery / ProperRatingBar

Inspired by stock android RatingBar. Simpler, has features that original lacks.
410 stars 70 forks source link

Issues with layout. #4

Open afaucogney opened 8 years ago

afaucogney commented 8 years ago

I know this is the beginning of the lib, so to help you i just post my test that results with some strange behavior time to times.

This is taken from AS.

layout-2015-10-28-104119

This one from the device

device-2015-10-28-104224

My layout is:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity">

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:orientation="vertical">

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <io.techery.properratingbar.ProperRatingBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="22sp"
            android:textStyle="bold"
            app:prb_defaultRating="4"
            app:prb_symbolicTick="$"
            app:prb_symbolicTickNormalColor="@android:color/darker_gray"
            app:prb_symbolicTickSelectedColor="@android:color/holo_green_dark"
            app:prb_totalTicks="6" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <io.techery.properratingbar.ProperRatingBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="22sp"
            android:textStyle="bold"
            app:prb_defaultRating="4"
            app:prb_symbolicTick="★"
            app:prb_symbolicTickNormalColor="@android:color/darker_gray"
            app:prb_symbolicTickSelectedColor="@android:color/holo_green_dark"
            app:prb_totalTicks="6" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <io.techery.properratingbar.ProperRatingBar
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="22sp"
            android:textStyle="bold"
            app:prb_defaultRating="4"
            app:prb_symbolicTick="★"
            app:prb_symbolicTickNormalColor="@android:color/darker_gray"
            app:prb_symbolicTickSelectedColor="@android:color/holo_green_dark"
            app:prb_totalTicks="6" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <io.techery.properratingbar.ProperRatingBar
            android:layout_width="match_parent"
            android:layout_height="10dp"
            android:textSize="22sp"
            android:textStyle="bold"
            app:prb_defaultRating="4"
            app:prb_symbolicTick="★"
            app:prb_symbolicTickNormalColor="@android:color/darker_gray"
            app:prb_symbolicTickSelectedColor="@android:color/holo_green_dark"
            app:prb_totalTicks="6" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <io.techery.properratingbar.ProperRatingBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textStyle="bold"
            app:prb_defaultRating="4"
            app:prb_symbolicTick="★"
            app:prb_symbolicTickNormalColor="@android:color/darker_gray"
            app:prb_symbolicTickSelectedColor="@android:color/holo_green_dark"
            app:prb_totalTicks="6" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <io.techery.properratingbar.ProperRatingBar
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textStyle="bold"
            app:prb_defaultRating="4"
            app:prb_symbolicTick="★"
            app:prb_symbolicTickNormalColor="@android:color/darker_gray"
            app:prb_symbolicTickSelectedColor="@android:color/holo_green_dark"
            app:prb_totalTicks="6" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <io.techery.properratingbar.ProperRatingBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="20sp"
            android:textStyle="bold"
            app:prb_defaultRating="4"
            app:prb_symbolicTick="★"
            app:prb_clickable="true"
            app:prb_tickSpacing="10sp"
            app:prb_symbolicTickNormalColor="@android:color/darker_gray"
            app:prb_symbolicTickSelectedColor="@android:color/holo_green_dark"
            app:prb_totalTicks="6" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <io.techery.properratingbar.ProperRatingBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="20sp"
            android:textStyle="bold"
            app:prb_defaultRating="4"
            app:prb_symbolicTick="★★★☆✩✪"
            app:prb_clickable="true"
            app:prb_tickSpacing="10sp"
            app:prb_symbolicTickNormalColor="@android:color/darker_gray"
            app:prb_symbolicTickSelectedColor="@android:color/holo_green_dark"
            app:prb_totalTicks="6" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <io.techery.properratingbar.ProperRatingBar
            fontPath="fonts/SanFransiscoDisplay-Regular.otf"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="20sp"
            android:textStyle="bold"
            app:prb_defaultRating="4"
            app:prb_symbolicTick="★"
            app:prb_clickable="true"
            app:prb_tickSpacing="10sp"
            app:prb_symbolicTickNormalColor="@android:color/darker_gray"
            app:prb_symbolicTickSelectedColor="@android:color/holo_green_dark"
            app:prb_totalTicks="6" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <io.techery.properratingbar.ProperRatingBar
            fontPath="fonts/Besom.ttf"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="20sp"
            android:textStyle="bold"
            app:prb_defaultRating="4"
            app:prb_symbolicTick="a"
            app:prb_clickable="true"
            app:prb_tickSpacing="10sp"
            app:prb_symbolicTickNormalColor="@android:color/darker_gray"
            app:prb_symbolicTickSelectedColor="@android:color/holo_green_dark"
            app:prb_totalTicks="6" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <io.techery.properratingbar.ProperRatingBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="20sp"
            android:textStyle="bold"
            app:prb_defaultRating="4"
            app:prb_symbolicTick="a"
            app:prb_clickable="true"
            app:prb_tickSpacing="10sp"
            app:prb_symbolicTickNormalColor="@android:color/darker_gray"
            app:prb_symbolicTickSelectedColor="@android:color/holo_green_dark"
            app:prb_totalTicks="6" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:orientation="vertical">

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <io.techery.properratingbar.ProperRatingBar
            android:id="@+id/ratingBar"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:prb_clickable="true"
            app:prb_defaultRating="4"
            app:prb_tickNormalDrawable="@drawable/i_rating_star_off"
            app:prb_tickSelectedDrawable="@drawable/i_rating_star_on"
            app:prb_totalTicks="6" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <io.techery.properratingbar.ProperRatingBar
            android:layout_width="wrap_content"
            android:layout_height="10dp"
            app:prb_clickable="true"
            app:prb_defaultRating="4"
            app:prb_tickNormalDrawable="@drawable/i_rating_star_off"
            app:prb_tickSelectedDrawable="@drawable/i_rating_star_on"
            app:prb_totalTicks="6" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <io.techery.properratingbar.ProperRatingBar
            android:layout_width="100dp"
            android:layout_height="wrap_content"
            app:prb_clickable="true"
            app:prb_defaultRating="4"
            app:prb_tickNormalDrawable="@drawable/i_rating_star_off"
            app:prb_tickSelectedDrawable="@drawable/i_rating_star_on"
            app:prb_totalTicks="6" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <io.techery.properratingbar.ProperRatingBar
            android:layout_width="100dp"
            android:layout_height="wrap_content"
            app:prb_clickable="true"
            app:prb_defaultRating="4"
            app:prb_tickNormalDrawable="@drawable/i_rating_star_off"
            app:prb_tickSelectedDrawable="@drawable/i_rating_star_on"

            app:prb_totalTicks="6" />

        <!--app:prb_tickSpacing="10dp"-->

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <io.techery.properratingbar.ProperRatingBar
            android:layout_width="50dp"
            android:layout_height="wrap_content"
            app:prb_clickable="true"
            app:prb_defaultRating="4"
            app:prb_tickNormalDrawable="@drawable/i_rating_star_off"
            app:prb_tickSelectedDrawable="@drawable/i_rating_star_on"

            app:prb_totalTicks="6" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <io.techery.properratingbar.ProperRatingBar
            android:layout_width="100dp"
            android:layout_height="10dp"
            app:prb_clickable="true"
            app:prb_defaultRating="4"
            app:prb_tickNormalDrawable="@drawable/i_rating_star_off"
            app:prb_tickSelectedDrawable="@drawable/i_rating_star_on"
            app:prb_tickSpacing="0dp"
            app:prb_totalTicks="6" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <io.techery.properratingbar.ProperRatingBar
            android:layout_width="100dp"
            android:layout_height="10dp"
            app:prb_clickable="true"
            app:prb_defaultRating="4"
            app:prb_tickNormalDrawable="@drawable/i_rating_star_off"
            app:prb_tickSelectedDrawable="@drawable/i_rating_star_on"
            app:prb_tickSpacing="-10dp"
            app:prb_totalTicks="6" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <io.techery.properratingbar.ProperRatingBar
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:prb_clickable="true"
            app:prb_defaultRating="4"
            app:prb_tickNormalDrawable="@drawable/i_rating_star_off"
            app:prb_tickSelectedDrawable="@drawable/i_rating_star_on"
            app:prb_tickSpacing="0dp"
            app:prb_totalTicks="6" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />
    </LinearLayout>

</LinearLayout>
Den-Rimus commented 8 years ago

No response from us so far has been given for this issue. This means we saw it but don't have time to even investigate the problem. From the top of my head I can say for sure that element behaves incorrectly when the size of it tries to be less than it would assume to wrap it's content.

That applies both to size set as constant or as weight, if the latter one shrinks element too much.

As a workaround I would propose using wrap_content width, with parent that allows ProperRatingBar to take all the space it needs (or you can use set of weights that will do the same).

We will address this issue later during one of nearest updates for this library.

sushant23 commented 7 years ago

I am having same problem. Did you find any solution for this?