Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
String有没有办法通过反射或生成它来获取视图引用的名称?
String
例子:
public static final int main = 0x7f030000;
我有0x7f030000,我想要"main";
0x7f030000
"main"
Field[] fields = R.layout.class.getDeclaredFields(); for(Field f : fields) { String fieldName = f.getName(); int fieldValue = (Integer) f.get(new Integer(0)); // ... }