Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Android : Custom slider padding

$
0
0

Hi all,

I'm trying to implement a slider with custom images. It works pretty well for iOS, both simulator and physical devices (iPhone4 and iphone5).

However, on Android, there is a kind of internal padding, resulting in the image elements being centered inside the view but not snapping to its limits.

I can verify it by setting a backgroundColor. (see images below).

Since I'm putting a serie of labels above the slider with numbers indicating meaningful steps, positioned accordingly, I need the elements within the Slider to snap to its outer limits.

The result on a genymotion simulator (which is the same as on an actual physical device, except for the interpretation of the thumb size, which doesn't matter here I think)

alt android-simulator

The expected result is the one I have on the iphone Simulator (and real iphones 4 and 5, except for the track's height, which is correct on a real device)

alt iphone-simulator

The slider is instantiated the following way

slider = Titanium.UI.createSlider( min: min, max: max, width: "75%", left: "5%", value: fieldValue === null ? 0 : fieldValue, leftTrackImage: "images/sliderLeftTrack.jpg", rightTrackImage: "images/sliderRightTrack.jpg", thumbImage: "images/sliderThumbImage.png" });

I haven't found any android specific properties that could explain this behavior.

Any help appreciated

Léonard


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>