Android反射获取com.android.internal.R.styleable 
时间: 2023-04-03 12:04:47 浏览: 65
我可以回答这个问题。在 Android 中,com.android.internal.R.styleable 是一个内部资源,它包含了系统的一些样式属性。如果你想要通过反射获取这个资源,可以使用以下代码:
Class<?> clazz = Class.forName("com.android.internal.R$styleable");
Field[] fields = clazz.getFields();
int[] styleableRes = (int[]) fields[0].get(null);
其中,clazz 表示 com.android.internal.R.styleable 的类对象,fields 表示该类中所有的字段,styleableRes 表示 com.android.internal.R.styleable 的值。
相关问题
android r.style
引用\[1\]中提到了在layout文件中设置MyView的style属性为@style/RedStyle。这意味着我们可以在styles.xml文件中找到名为RedStyle的样式定义。同样地,我们可以在styles.xml文件中找到名为GreenStyle的样式定义,因为在引用\[3\]中提到了将myViewStyle赋值为@style/GreenStyle。所以,android中的r.style包含了RedStyle和GreenStyle这两个样式。
#### 引用[.reference_title]
- *1* *2* *3* [Android中View自定义XML属性详解以及R.attr与R.styleable的区别](https://blog.csdn.net/sunqunsunqun/article/details/50708044)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
if (sa.getBoolean( R.styleable.AndroidManifestApplication_directBootAware, false)) { ai.privateFlags |= ApplicationInfo.PRIVATE_FLAG_DIRECT_BOOT_AWARE;
如果sa.getBoolean(R.styleable.AndroidManifestApplication_directBootAware, false)返回真,那么将ai.privateFlags的值设为 ai.privateFlags | ApplicationInfo.PRIVATE_FLAG_DIRECT_BOOT_AWARE。这句话的意思是判断是否开启了directBootAware属性,如果开启了,就将ai.privateFlags的值设为ai.privateFlags | ApplicationInfo.PRIVATE_FLAG_DIRECT_BOOT_AWARE,即添加ApplicationInfo.PRIVATE_FLAG_DIRECT_BOOT_AWARE标志。
相关推荐















