We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

SfRating not centering in RelativeLayout

Hello,

[Primary Question]

I have a SfRating inside a RelativeLayout, which is inflated by a AlertDialog that isn't centering the control horizontally. Below is the AXML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
      <com.syncfusion.rating.SfRating
        android:id="@+id/rate"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:layout_centerHorizontal="true" />
</RelativeLayout>

All others controls are centered horizontally when android:layout_centerHorizontal="true" inside a RelativeLayout. SfRating should've done the same, right?

I managed that using the hack below:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:orientation="horizontal">
  <RelativeLayout
      android:layout_width="0dip"
      android:layout_height="fill_parent"
      android:layout_weight="0.15">
  </RelativeLayout>
  <RelativeLayout
      android:layout_width="0dip"
      android:layout_height="fill_parent"
      android:layout_weight="0.7">
    <com.syncfusion.rating.SfRating
      android:id="@+id/rate"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_marginTop="10dp" />
  </RelativeLayout>
  <RelativeLayout
      android:layout_width="0dip"
      android:layout_height="fill_parent"
      android:layout_weight="0.15">
  </RelativeLayout>
</LinearLayout>

[Secondary Question]

Is that a way that i can set the ItemSize to be scalable, according to the screen size?

Example: If a set ItemSize to 30, in a 5' screen, using the hack AXML above, is ok, but in a 3,5' screen, just appears 3 stars.

Thanks in advance.

Regards,
Leonardo Souza

7 Replies

CP Chozarajan Pandiyarajan Syncfusion Team October 28, 2016 12:34 PM UTC

Hi Leonardo,

Thanks for contacting Syncfusion Support.

We were already fixed these issue in Android platform. Can you please update which version you are used and device specification details. It has more convenience to assist you further.

Regards,
Chozarajan P



LT Leonardo Trindade dos Santos Souza October 28, 2016 01:42 PM UTC

Hi,

Detais:

Syncfusion.SfRating.Android
Runtime Version: v4.0.30319
Version: 14.3451.0.49

Device 1:
Samsung Galaxy S III
Android 4.2 - API 17

Device 2:
Samsung Galaxy Duos Mini
Android 4.4 - API 19

Regards,
Leonardo Souza


PK Pavendhan Kumar Syncfusion Team October 31, 2016 12:41 PM UTC

Hi Leonardo,

Thank you for your update.

We were unable to reproduce the reported behaviour at our end.(Tested with some other devices having same screen size). So could you please update the following details that would help us to work inline with your requirement.

1) Sample project for replicating the issue
2)Video footage or Screen shot of the issue.

Regards,
Pavendhan K.



LT Leonardo Trindade dos Santos Souza November 3, 2016 12:03 AM UTC

Hi Chozarajan,

While i was isolating the problem in a another project to share here, i tested and it's working normally, like you said. Something is wrong with my main project, i will figure it out later... Now, can you asnwer my secondary question: "Is that a way that i can set the ItemSize to be scalable, according to the screen size?"

Thanks in advance.

Regards,
Leonardo Souza


PK Pavendhan Kumar Syncfusion Team November 3, 2016 12:50 PM UTC

Hi Leonardo,

Thank you for your update.

Query: How to auto resize the ItemSize?.

In order to auto resize the items first we have to calculate the width/height of the device based on that we can auto resize the items. We have created a sample as per your scenario please download the same from the following link.

Link: http://www.syncfusion.com/downloads/support/forum/127115/ze/RatingAutoResize-447867233 

Please let us know whether the sample meets your requirement or not.

Regards,
Pavendhan K. 



LT Leonardo Trindade dos Santos Souza November 3, 2016 04:59 PM UTC

Hi Pavendhan,

The sample is great. Thank you guys.

Regards,
Leonardo Souza


PK Pavendhan Kumar Syncfusion Team November 4, 2016 09:48 AM UTC

Hi Leonardo,

Thank you for your update. Please feel free to contact us for any queries.

Regards,
Pavendhan K.

Loader.
Live Chat Icon For mobile
Up arrow icon