java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library
我遇到这个错误是在fragment里应用了coordinatorLayout,xml inflate无效
查了好多这是最新的sdk的bug
解决办法:在style里写一个自定义的style,然后在加入这个fragment的Activty 添加theme
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<activity
android:name="EventsDetailsActivity"
android:theme="@style/AppTheme.NoActio>
还有一种方法就是直接给fragment添加theme,在代码里直接添加
final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.community_theme);
// clone the inflater using the ContextThemeWrapper
LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
View viewRoot = localInflater.inflate(R.layout.fragment_rank_landing, container, false);