Android ids.xml 的作用

ids概述

ids.xml:为应用的相关资源提供唯一的资源id。id是为了获得xml中的对象需要的参数,也就是 Object = findViewById(R.id.id_name); 中的id_name。

使用

例如xml中定义如下


    

xml中使用id

java使用id

Button button = new Button(this);
button.setId(R.id.btn_next);

 

你可能感兴趣的:(android开发)