java中的安卓 studio调用方法,没有对象或类名
Button myButton = (Button) findViewById(R.id. my_button)
据我所知,在java中,所有代码都必须在一个类主体上,也就是说,如果我们调用一个方法,我们必须通过对象调用它,或者如果它是一个静态方法,然后通过它的类名bla.findViewByID(somemoreblass)
但在安卓 studio中,我看到了这个Button myButton = (Button) findViewById(R.id. my_button)
有人能解释一下它是怎么工作的吗
共 (0) 个答案