这可能非常简单,但我在android开发中遇到了settext问题.
以下代码:
TextView countDownTextView = FindViewById<TextView> (Resource.Id.countdownTimer);
countDownTextView.SetText ("New text");
Run Code Online (Sandbox Code Playgroud)
给出错误:
The best overloaded method match for 'Android.Widget.TextView.SetText(int)' has some invalid arguments
Argument 1: cannot convert from 'string' to 'int'
Run Code Online (Sandbox Code Playgroud)
现在settext应该是(字符串)但是由于某种原因,当我编写它时,它需要int残余.如何使用settext和字符串更改Textview?
我试过用过
string value ="new text"
Run Code Online (Sandbox Code Playgroud)
但那也没有用.
制作一个更简单的版本,但得到同样的问题
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace CountdownTest
{
[Activity (Label = "CountdownTest", MainLauncher = true)]
public class MainActivity : Activity
{
int count = 1;
protected override void OnCreate (Bundle bundle)
{
base.OnCreate …Run Code Online (Sandbox Code Playgroud)