ids概述
ids.xml:爲應用的相關資源提供唯一的資源id。id是爲了獲得xml中的對象需要的參數,也就是 Object = findViewById(R.id.id_name); 中的id_name。
使用
例如xml中定義如下
<resources>
<item type="id" name="btn_next" />
</resources>
xml中使用id
<Button
android:id="@id/btn_next"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="next"/>
java使用id
Button button = new Button(this);
button.setId(R.id.btn_next);