2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

R.layout.activity_mainってなに?

Last updated at Posted at 2017-12-16
public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

ソースコードを追ってみると、Rクラスのlayout(staticなメンバークラス)のactivity_mainという変数を参照している。
Rクラスではjavaで使用する変数と様々なファイル(Androidで描画などに使用するxmlファイル)の紐付けをしている模様。
Rクラスはパッケージ直下のディレクトリに配置されている(MainActivity.javaなどと一緒の階層)。Android StudioではProjectウィンドウでPackageを選択すると探しやすい。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?