【问题标题】:Why this method has no definition in my IDE?为什么这个方法在我的 IDE 中没有定义?
【发布时间】:2017-02-11 22:00:37
【问题描述】:

我正在使用c# 语言在 xamarin、visual studio 中进行 android 编程。 我想写以下内容:

Spinner myspinner = FindViewById<Spinner>(Resource.Id.myspinner);
string text = myspinner.getSelectedItem().toString();

我收到一个错误,指出 getselecteditem() 未定义。我能做什么?

【问题讨论】:

  • 什么是spinner2。询问时请提供更多代码/上下文。
  • 这是 Spinner 的名称。为了更清楚,我将其更改为“myspinner”。

标签: android xamarin


【解决方案1】:

请尝试:

Spinner myspinner = FindViewById<Spinner>(Resource.Id.myspinner);
string text = myspinner.SelectedItem.toString();

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-17
    • 2019-09-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多