Can you help me implement a SliderRange in Xamarin Android, I have searched, but there is only information for xamarin forms, or do they have a link with documentation on how it is used?
Asked
Active
Viewed 221 times
0
-
In Android, it is [seekbar](https://stackoverflow.com/a/6774182/8632294), you can custom it to a range slider. – Robbit May 16 '18 at 05:50
2 Answers
2
I recently had a similar implementation on Android and iOS and RangeSlider was the component I used for making a Slider Range :
RangeSlider is a slider control with two handles, allowing users to specify two values in a range. RangeSlider supports iOS and Android and is styled to look like a native slider control on each platform.
You might have to say that components are obsolete and will be removed soon rest assured they will be moving things to NuGet then. And you can find the same here (For Assurance)
Through Xml you can use it like this:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<rangeslider.RangeSliderView
android:id="@+id/rangeSlider"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
min_value="0"
max_value="100"
left_value="20"
right_value="80"/>
</LinearLayout>
Programmatically you can do something like this:
using RangeSlider;
...
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
var slider = new RangeSliderView (this);
AddContentView (slider, new ViewGroup.LayoutParams (
ViewGroup.LayoutParams.FillParent,
ViewGroup.LayoutParams.FillParent));
}
Goodluck!
Incase you have issues surely revert!

FreakyAli
- 13,349
- 3
- 23
- 63
-
the solution was very similar with your answer, thanks, I will attach the answer – Oscar Navarro May 16 '18 at 14:26
0
using Xamarin.RangeSlider;
private LinearLayout LinearRoot;
protected override void InitViews()
{
LinearRoot = mView.FindViewById<LinearLayout>(Resource.Id.layoutRangeRoot);
var slider = new RangeSliderControl(this.Activity);
LinearLayout LinearRange = new LinearLayout(this.Activity);
LinearRange.Orientation = Orientation.Horizontal;
LinearRange.AddView(slider);
LinearRoot.AddView(LinearRange);
}

Oscar Navarro
- 150
- 10