If you want to change the width of Slider for android platform.
You can create a drawable folder in the Android/Resources
folder, create a xml file called custom_seekbar_progress.xml and set the build action to the AndroidResouces
<?xml version="1.0" encoding="utf-8" ?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape android:shape="rectangle" >
<solid android:color="#CCCCCC" />
<!-- background color -->
<corners android:radius="5dp" />
<size android:height="10dp" />
<!-- progress height -->
</shape>
</item>
<item android:id="@android:id/progress" >
<clip>
<shape android:shape="rectangle">
<solid android:color="#FFff00EE" />
<!-- seekbar color -->
<corners android:radius="5dp" />
<size android:height="10dp" />
<!-- progress height -->
</shape>
</clip>
</item>
</layer-list>
Then you can set seekBar.ProgressDrawable
in the SliderHandler
SliderHandler.Mapper.AppendToMapping(nameof(Microsoft.Maui.Controls.Slider), (Handler, view) =>
{
#if ANDROID
if (Handler.PlatformView is SeekBar seekBar)
{
seekBar.MaxHeight = 10;
seekBar.MinHeight = 10;
seekBar.ProgressDrawable=Platform.AppContext.Resources.GetDrawable(Resource.Drawable.custom_seekbar_progress, null);
}
#endif
});