C# 如果用户在Android应用程序中单击按钮,如何显示要列出的文本
我正在尝试使用Xamarin中的C为Android创建一个应用程序,用户可以从复选框中选择短语,并将它们添加到另一个页面,在该页面上显示结果。下面是结果页面的代码。我的问题在于“添加韵文”按钮。我正在尝试这样做,用户将按下韵文按钮,它将显示到列表中自己的文本框中的文本韵文。我不确定我应该使用什么代码。我用于它的代码工作不正常。请帮忙C# 如果用户在Android应用程序中单击按钮,如何显示要列出的文本,c#,android,list,xamarin,xamarin.android,C#,Android,List,Xamarin,Xamarin.android,我正在尝试使用Xamarin中的C为Android创建一个应用程序,用户可以从复选框中选择短语,并将它们添加到另一个页面,在该页面上显示结果。下面是结果页面的代码。我的问题在于“添加韵文”按钮。我正在尝试这样做,用户将按下韵文按钮,它将显示到列表中自己的文本框中的文本韵文。我不确定我应该使用什么代码。我用于它的代码工作不正常。请帮忙 namespace Songression { public class CheckRect{ public int top{ get; set; }
namespace Songression
{
public class CheckRect{
public int top{ get; set; }
public int height{ get; set; }
}
[Activity (Label = "Songression")]
public class results : Activity, View.IOnTouchListener
{
//CheckBox[] check;
List<LinearLayout> linearSet;
//List<CheckRect> rectList;
ScrollView scrollView;
EditText editText = null;
LinearLayout view;
bool moveOrEdit = false;
int screenWidth;
List<String> checkTextList;
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.results);
var metrics = Resources.DisplayMetrics;
screenWidth = metrics.WidthPixels;
//var widthInDp = ConvertPixelsToDp(metrics.WidthPixels);
view = FindViewById<LinearLayout> (Resource.Id.linearlayout0);
checkTextList = new List<String>();
checkTextList.Add ("10 bucks in your pocket and barely making it.");
checkTextList.Add ("100 steps to the water");
checkTextList.Add ("18 and going to Hollywood");
checkTextList.Add ("3 years to propose");
String checkTextSet = Intent.GetStringExtra ("MyData") ?? "";
if (checkTextSet == null || checkTextSet == "") {
} else {
String[] textSet = checkTextSet.Split (',');
checkTextList.AddRange (textSet);
}
//Back Button
Button buttonBack = FindViewById<Button> (Resource.Id.buttonBack);
buttonBack.Click += delegate {
Finish();
};
///
//AddLine Button
Button buttonAdd = FindViewById<Button> (Resource.Id.buttonAdd);
buttonAdd.Click += delegate {
addTextPro(false,"");
};
///
//Add Verse
Button buttonVerse = FindViewById <Button> (Resource.Id.buttonVerse);
buttonVerse.Click += delegate {
checkTextList.Add(new TextView ("Verse"));
};
你的问题我不清楚,你能说清楚一点吗!!问题在于“添加韵文”按钮。当用户单击它时,他们应该将该诗句的文本视图添加到检查文本列表中。我不确定我做错了什么。请帮忙//添加Verse Button buttonVerse=FindViewById Resource.Id.buttonVerse;buttonVerse.Click+=委托{checkTextList.Addnew TextView Verse;};但是您的checkTextList是字符串列表,您正在列表中添加TextView!!!!!我也不清楚checkTextList是一个字符串列表,它是如何绑定到任何视图的?我在代码中没有看到与复选框或编辑文本相关的内容?请提供更完整的代码示例