question

njsokalski avatar image
0 Votes"
njsokalski asked ·

Expander for Xamarin.Android

I am focusing on writing my apps directly in Xamarin.Android rather than Xamarin.Forms (Android is my only planned target, and I have found that most of the stuff I did in Xamarin.Forms required large amounts of almost complete rewrites for native anyway), and am looking for a way to do something similar to what the Expander from the Xamarin Community Toolkit did. Because I am very new to Xamarin.Android (actually, I am new to Xamarin overall, all my history is in UWP), I was wondering if anybody had any suggestions on what might be a good way to create a control similar to the Expander (or if there is an existing control that is relatively similar, where to find it). Thank you to anybody who can help me get started.

dotnet-android
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JessieZhang-2116 avatar image
0 Votes"
JessieZhang-2116 answered ·

Hello,


Welcome to our Microsoft Q&A platform!

In xamarin android, there are two similar views which are the ExpandedMenuView and Expandable ListView .

For ExpandedMenuView, you can check the tutorial Xamarin Android Tutorial - Expandable Menu .

For Expandable ListView , you can check Xamarin Android Tutorial - Expandable ListView

If you really want this functionality, you can just use Expander in xamarin forms, which could run both on android and ios platforms.

Hope it can help you.


Best Regards,

Jessie Zhang


If the response is helpful, please click "Accept Answer" and upvote it.


Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 2 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I'm not sure if those will work for my scenario. I basically just want a header & content, but it looks like ExpandableListView is used to display a header & a collection. I could, of course just do something like make a collection of 1 item, but that seems inefficient and would probably involve more code and extra effort in the UI. What control(s) are generated by the renderer for Expander when that is used in Xamarin.Forms? If necessary, I could create the functionality manually, but I figured if there is an existing control that does this I should take advantage of it.

0 Votes 0 ·

What control(s) are generated by the renderer for Expander when that is used in Xamarin.Forms?

It is a custom view in xamarin forms, for this,you can check the source of Expander here:https://github.com/xamarin/XamarinCommunityToolkit/tree/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Views/Expander


0 Votes 0 ·