android 使用TabLayout出现的问题
在项目中 使用 viewpager+TabLayout达到滑动美观的效果,运行项目后报出如下错误
看了下相关资料,出错的原因是 activity的 theme不是AppCompat的
activity android:name=”.ui.GoodsInfoActivity”
android:theme=”@style/nornal_style”
把theme改成AppTheme之后运行正常
附 AppTheme
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>