Xamarin 创建活动以提供多个选项供选择

Xamarin 创建活动以提供多个选项供选择,xamarin,xamarin.android,Xamarin,Xamarin.android,我是新的Xamarin android开发人员。如果这个问题听起来很简单,请原谅。我正在创建一个表单,我需要为用户提供选择多个选项的选项,有点像复选框组。期权的数量可能更大,比如10-20个。我不知道要使用哪个控件或布局,以便用户阅读和选择选项。我尝试了线性和垂直布局选项,但看起来不太好。还有,如何基于某些数据源以编程方式创建这些选项。请建议我最好的设计方法。任何帮助都将不胜感激。下面是我的axml中的代码片段 我已经尝试使用LinearLayout和checkbox控件 <LinearL

我是新的Xamarin android开发人员。如果这个问题听起来很简单,请原谅。我正在创建一个表单,我需要为用户提供选择多个选项的选项,有点像复选框组。期权的数量可能更大,比如10-20个。我不知道要使用哪个控件或布局,以便用户阅读和选择选项。我尝试了线性和垂直布局选项,但看起来不太好。还有,如何基于某些数据源以编程方式创建这些选项。请建议我最好的设计方法。任何帮助都将不胜感激。下面是我的axml中的代码片段

我已经尝试使用LinearLayout和checkbox控件

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"          
android:layout_width="match_parent"
android:layout_height="match_parent">
 <CheckBox
     android:id="@+id/blogging"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:text="Blog"/>
  <CheckBox
     android:id="@+id/game"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"               
     android:text="Game" />                 

找到了我要找的东西。它被称为切换工具。因此,为了提供类似页面的设置选项,我将使用此选项而不是复选框

你能直观地告诉我你的问题是什么吗confusing@G.hakim谢谢你的回复。这基本上是一个设计问题。我必须设计一个用户界面,用户可以选择多个选项。选项的数量可以很大,比如15-20个,这样会占用屏幕上的大量空间。我在线性布局中添加了多个复选框。看起来不太好。我在寻找我还有什么选择?xamarin工具包中是否有内置控件/工具。任何指向示例代码的指针都将不胜感激。类似于iOS/android应用程序中的设置页面,用户可以查看选项列表,他/她可以打开/关闭。Xamarin.android只是原生android,后面有C#代码(而不是java)。它只有原生android中可用的东西,我不知道您所说的任何此类控制@谢谢你的回复。我想我找到了我要找的东西。这叫做开关控制。我用它来创建像页面这样的设置。这是供其他人查找的示例代码段。请尝试将其标记为答案,它将帮助有类似问题的其他人。当然@LeonLu MSFT。它不让我投票支持我的答案:)
Found what I was looking for. It's called the Switch tool. So to provide settings page like options, I'll use this instead of checkboxes
<Switch
   android:id="@+id/blogging"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:theme="@style/Widget.AppCompat.CompoundButton.Switch"
   android:hint="Blog"
  />
<Switch
   android:id="@+id/game"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:theme="@style/Widget.AppCompat.CompoundButton.Switch"             
   android:text="Game" />