Quantcast
Channel: OKWAVE 最新質問(開発/975)【本日】
Viewing all articles
Browse latest Browse all 2006

android inflateメソッドについて

$
0
0
eclipseから「新規アプリケーション・プロジェクト」でプロジェクトを作成すると下記のコードが自動作成されます。 package com.example.hello; import android.os.Bundle; import android.app.Activity; import android.view.Menu; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @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; } } この中で、inflateメソッドにカーソルを当てると  void android.view.MenuInflater.inflate(int menuRes, Menu menu) が表示されるので、MenuInflaterクラスのメソッドだと確認できます。 しかし、import文でMenuInflaterクラスを定義していないのになぜ使用できるのでしょうか。

Viewing all articles
Browse latest Browse all 2006

Latest Images

Trending Articles

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>