Open 2ndGAB opened 7 years ago
I don't know why it shows only 3 starts on Galaxy S4.
But the values you have are to be expected.
The dp
measure unit it's dependent on the ppi (pixel density of the device. Although both devices have the same resolution, they don't have the same ppi.
You can see here that Galaxy S4 has 441 ppi, where here that Nexus 7 has 216 ppi. Thus, 42 dp
is 126 pixels
on Galaxy S4, but 84 pixels
on Nexus 7
@FlyingPumba so it explain how the display is not correct I think.
Let's start by the nexus 7. Here is the screen part in full width:
The screen is 1080 pixels wide. If the value of 84 pixels for 42 dp is correct then, 5 stars and 4 spaces occupies 84 * 9 = 756 pixels, which seems to be quite logical regarding the screenshot.
Now let's consider the Galaxy S4 case:
The screen is also 1080 pixels wide.If the value of 126 pixels for 42 dp is correct then, 5 stars and 4 spaces occupies 126* 9 = 1134 pixels, which explains why the 7 stars cannot be displayed.
So I think there is something wrong somewhere.
I think that for 2 devices with the same screen resolution, the size in pixels should be the same no?
Or there is something I didn't undestand.
And why getStarSize() returns 0?
I think it would be very intersting to have a fill
option for srb_gravity
, which calculates automatically srb_starsSeparation to fill the available space.
@2ndGAB getStarSize()
shouldn't return 0, that's weird.
The problem here is that I can't reproduce this behaviour, since I don't have a Galaxy S4 or a Nexus 7.
If you can provide a sample project I'll try to reproduce it on my phone.
I think it would be very intersting to have a fill option for srb_gravity, which calculates automatically srb_starsSeparation to fill the available space.
srb_gravity
is not meant for that, it only changes the direction of the fill. Nevertheless, the behaviour you describe is the default behaviour when the user doesn't provide star separation.
Perhaps the problem is related to the fact that you are using the rating bar on a dialog, have you tried a normal layout to see what happens ?
Nevertheless, the behaviour you describe is the default behaviour when the user doesn't provide star separation.
! ? ! There is a big problem here because it's not the default behavior I see.
here is the sample test project.
@2ndGAB I'll look into the example project. and let you know if I find anything.
Hello, I encounter a strange behavior with![ratingBar](https://i.imgur.com/c2zkaUu.png)
app:srb_starSize
andapp:srb_starsSeparation
. I've created a layout with value42dp
for both of these values, displaying 5 stars. That perfectly render on Nexus7 (1920x1080, 7 inches):But it only displays 3 stars on a Galaxy S4 (1920x1080, 5.4 inches). So I wanted to have a look at the star and separation size to see if I have to adapt the values and they are quite surprizing:
On Nexus 7:
ratingBar.getStarSize() = 0.0 ratingBar.getStarsSeparation() = 84.0
On Galaxy S4:
ratingBar.getStarSize() = 0.0 ratingBar.getStarsSeparation() = 126.0
How do you explain these values?