? ? protected void onCreate(Bundle savedInstanceState) {
? ? ? ? super.onCreate(savedInstanceState);
? ? ? ? setContentView(R.layout.activity_main);
? ? }
老師,上面這段代碼的意思是神馬??
? ? protected void onCreate(Bundle savedInstanceState) {
? ? ? ? super.onCreate(savedInstanceState);
? ? ? ? setContentView(R.layout.activity_main);
? ? }
老師,上面這段代碼的意思是神馬??
2014-10-12
舉報(bào)
2014-10-13
現(xiàn)在的新版本都會(huì)自動(dòng)添加這兩個(gè)方法,是和Menu菜單有關(guān)的兩個(gè)方法,如果不涉及Menu菜單可以直接刪除掉
2014-10-13
哦哦謝老師,,還有,為什么我的代碼下面還有這兩個(gè)方法
?@Override
? ? public boolean onCreateOptionsMenu(Menu menu) {
? ? ? ? // Inflate the menu; this adds items to the action bar if it is present.
? ? ? ? getMenuInflater().inflate(R.menu.main, menu);
? ? ? ? return true;
? ? }
? ? @Override
? ? public boolean onOptionsItemSelected(MenuItem item) {
? ? ? ? // Handle action bar item clicks here. The action bar will
? ? ? ? // automatically handle clicks on the Home/Up button, so long
? ? ? ? // as you specify a parent activity in AndroidManifest.xml.
? ? ? ? int id = item.getItemId();
? ? ? ? if (id == R.id.action_settings) {
? ? ? ? ? ? return true;
? ? ? ? }
? ? ? ? return super.onOptionsItemSelected(item);
? ? }
刪掉有影響嗎?
2014-10-13
onCreate方法就是用來實(shí)例化Activity對(duì)象,? super.onCreate(savedInstanceState);就是調(diào)用父類的方法來實(shí)現(xiàn)對(duì)界面的繪制,setContentView(R.layout.activity_main);就是加載布局