Android学习笔记(4):资源字典R.java

R.javaAndroid应用的资源文件

1. 每种资源在R类中是一个内部类

2. 每个资源是内部类里一个public static final int类型的变量

资源的使用:

1. 在Java代码中通过 R.资源对应的内部类的类名.资源项的名称 引用到该资源

2. 在XML文件中的访问格式为:@<资源对应的内部类的类名>/<资源项的名称>

当然在XML文件中可以用id访问:

1. 分配id@+id/<标识符代号>

2. 引用id@id/<标识符代号>

 

/* AUTO-GENERATED FILE.  DO NOT MODIFY.
 *
 * This class was automatically generated by the
 * aapt tool from the resource data it found.  It
 * should not be modified by hand.
 */
package android.support.v7.appcompat;
 
public final class R {
public static final class color {
public static final int abc_background_cache_hint_selector_material_dark = 0x7f0b0031;
}
public static final class dimen {
public static final int abc_action_bar_default_height_material = 0x7f080000;
}
public static final class drawable {
public static final int abc_ab_share_pack_holo_dark = 0x7f020000;
}
public static final class id {
public static final int action_bar = 0x7f0c0031;
}
public static final class integer {
public static final int abc_max_action_buttons = 0x7f090000;
}
public static final class layout {
public static final int abc_action_bar_title_item = 0x7f040000;
}
public static final class string {
public static final int abc_action_bar_home_description = 0x7f060000;
}
public static final class style {
public static final int Base_TextAppearance_AppCompat = 0x7f0a0027;
}
}

 

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