android关于使用Design库遇到的异常
来源:互联网 发布:淘宝代付能看到地址吗 编辑:程序博客网 时间:2024/06/05 02:11
在使用android5.0新特性的一些控件时,需要先compile一些库:
compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:design:23.1.1'
然而我在使用的时候仍然报错,系统提示异常信息未, you need a theme appcomt 作为该activity 的样式。于是乎,我打开style文件:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <!-- Customize your theme here. --> <item name="windowNoTitle">true</item> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="android:colorPressedHighlight">@color/colorAccent</item> <item name="drawerArrowStyle">@style/DrawerArrowStyle</item> <item name="android:actionMenuTextColor">@android:color/white</item> </style>
然而就是compat样式。
到底出了什么问题?
原来,我做了一个工具类,用的LayoutInflater得到了一个View,然而由此得到的view并没有引用到我们的Apptheme主题,所以该怎么办呢?
如下:
ContextThemeWrapper contextThemeWrapper = new ContextThemeWrapper(getContext(), R.style.AppTheme); LayoutInflater layoutInflater = LayoutInflater.from(getContext()).cloneInContext(contextThemeWrapper);
由此得到的layoutInflater就是填充了apptheme主题的了,接下来就去使用他吧!
0 0
- android关于使用Design库遇到的异常
- Android Design Support Library 使用遇到的bug Error inflating class android.support.design.widget.Navigat
- 关于使用ant-design设计可动态添加FormItem的过程中遇到的问题记录。
- 使用android studio过程中遇到的异常
- 使用android studio混淆过程中遇到的异常
- Android-Material Design的使用
- 关于VS2015 遇到异常 的解决方案
- Android Design库控件使用
- 关于android Listview 使用时遇到的几个问题
- 关于android Listview 使用时遇到的几个问题
- 关于android使用retrofit2 demo遇到的问题
- Android 关于使用阿里Freeline遇到的问题
- 关于Android Studio使用SVN遇到的一些问题
- 关于Fragment使用中遇到的异常:Fragment already added和fragment not attached&
- 关于Fragment使用中遇到的异常:Fragment already added和fragment not attached
- 关于Fragment使用中遇到的异常:Fragment already added和fragment not attached
- android design 全方位学习,应用实战遇到的问题。
- 使用material design组件遇到的一些问题
- 优秀css案例欣赏
- duplicate symbol SDK中重复引用公共变量的错误
- VS2005、VS2008、VS2010、VS2012解决方案和工程项目文件转换方法
- css3 字体
- C#控制台基础 hashtable修改已存在的键所对应的值
- android关于使用Design库遇到的异常
- maven工程中因为依赖产生的各种问题汇总
- scrollview中ListView显示不全解决
- 使用 googlebreak pad 解析 crash
- Node.js中使用redis数据库的正确姿势
- Eclipse使用JDBC连接MySQL数据库详细教程
- ss客户端使用方法(带附件)
- struts1与struts2的区别
- MongoDB 日志分析工具 mtools