findViewById在片段类中返回null

时间:2016-03-25 12:53:26

标签: android android-fragments findviewbyid

  • findViewById()在片段类中返回nullToast的{​​{1}}显示了一些内容,但ImageButton的对象即Switch返回mySwitch ...请帮助....

    null

1 个答案:

答案 0 :(得分:0)

我明白了...... 我在onGetView中定义了findViewById 我必须在OnCreateView上声明它 遗憾.....

相关问题