在清单中设置主题通常用于Activity。如果要设置Theme for Fragment,请在Fragment的onCreateView()中添加下一个代码:@Overridepublic View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // create ContextThemeWrapper from the original Activity Context with the custom theme final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.yourCustomTheme); // clone the inflater using the ContextThemeWrapper LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper); // inflate the layout using the cloned inflater, not default inflater return localInflater.inflate(R.layout.yourLayout, container, false);}