0
如何將主題設置爲片段?將主題設置爲片段
下面的代碼不適用於我,或者我錯了什麼地方?
public 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);
}
[設置主題爲片段]可能的重複(http://stackoverflow.com/questions/9469174/set-theme-for-a-fragment) –