Cannot change Slider height with handler Android. MAUI
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 296
Description
Description
We cannot change Slider's height with handler in Android. MAUI
Steps to Reproduce
1.created a maui app;
2.add the following code in MainPage.xaml.cs:
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
Microsoft.Maui.Handlers.SliderHandler.Mapper.AppendToMapping("MyCustomization", (handler, view) =>
{
#if ANDROID
// Update slider thickness
handler.PlatformView.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(100, 100);
handler.PlatformView.MinHeight = 100;
handler.PlatformView.SetMinimumHeight(100);
#endif
});
}
}
3.deploy this demo to an android device, but it couldn't change the Slider's height .
But we can change other properties(e.g. Progress) with following code:
handler.PlatformView.Min = 1;
handler.PlatformView.Max = 100;
handler.PlatformView.Progress = 50; // Set slider progress to 50%
Link to public reproduction project repository
You can reproduce this problem with above code.
Version with bug
Unknown/Other (please specify)
Last version that worked well
Unknown/Other
Affected platforms
Android, I was not able test on other platforms
Affected platform versions
android 9
Did you find any workaround?
No response
Relevant log output
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the SliderHandler.Mapper customization shown in MainPage.xaml.cs and trace how the Android PlatformView applies layout parameters and minimum height. Reproduce the issue on Android 9 using the provided handler code, then verify that the Slider's height changes while the existing Min, Max, and Progress behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, csharp
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100