【问题标题】:How to findViewById() an @android:id/list element in an Android activity?如何在 Android 活动中查找 ViewById() @android:id/list 元素?
【发布时间】:2010-08-10 15:11:01
【问题描述】:

我正在尝试通过使用 findViewById 函数来获取 ListView,但我不确定我要查找的内容或用作参数的内容:R.id.list 不起作用。

【问题讨论】:

    标签: android xml


    【解决方案1】:

    您可以致电:

    ListView mListView = (ListView) findViewById(android.R.id.list);
    

    【讨论】:

      【解决方案2】:

      在您的活动中,尝试 getListView(),您将可以访问您的 ListView

      【讨论】:

      • 这并不完全正确。这仅适用于 ListActivity。
      猜你喜欢
      • 1970-01-01
      • 2015-06-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多