I’m working on a .NET MAUI project using .NET MAUI 8 and targeting Android API Level 34 (Android 13).
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="34" />
What I’ve Tried:
- I ensured the layout for the dropdown uses
HorizontalOptions = FillAndExpand
.
- I tested with long text inside the dropdown, and it gets cut off on Android instead of wrapping to fit within the layout.
- A simple
Label
works fine and wraps text as expected, but the same behavior isn’t happening with the custom dropdown.
Here’s an example of the dropdown implementation:
<ScrollView x:Name="scrollView" VerticalOptions="Fill" HorizontalOptions="Fill"> <Grid Padding="20" x:Name="lytgridmain">
grdMain = new Grid()
{
RowDefinitions =
{
new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) },
},
ColumnDefinitions =
{
new ColumnDefinition { Width = new GridLength(7, GridUnitType.Star) },
new ColumnDefinition { Width = new GridLength(3, GridUnitType.Star) }
}
};
lytgridmain.Children.Add(grdMain);
drConnect = new CustomDropdown(this.absMain)
{
ClassId = "ConnectToBusOptions",
Title = UIDisplayText,
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.FillAndExpand
};
List<LOVModel> busOptionLov = new List<LOVModel>
{
new LOVModel { Text = "sample text every time", Value = "0", LOVID = "0" },
new LOVModel { Text = "sample text connect everytime to the upstream", Value = "6", LOVID = "6" },
new LOVModel { Text = "sample text connect everytime to the upstream example example", Value = "12", LOVID = "12" }
};
drConnect.ItemsSource = busOptionLov;grdMain.Add(drConnect, 1, 18);