I am trying to apply a specific theme on a Fragment. But for some reason it isn't happening. Can anyone point out mistakes in my code? Or better solutions?
Theme in styles.xml:
<!-- Theme for trans actionbar -->
<style name="TransTheme" parent="@style/AppTheme">
<item name="android:actionBarStyle">@style/TransActionbar</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="actionBarStyle">@style/TransActionbar</item>
<item name="windowActionBarOverlay">true</item>
</style>
Where @style/TransActionbar
is:
<!-- Actionbar style for trans theme -->
<style name="TransActionbar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">@color/first_trans_actionbar</item>
<item name="background">@color/first_trans_actionbar</item>
</style>
How I want to apply the theme in my fragment in the onCreateView()
method:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
//set theme
final Context contextWrapper = new ContextThemeWrapper(getActivity(), R.style.TransTheme);
LayoutInflater localInflater = inflater.cloneInContext(contextWrapper);
contentView = localInflater.inflate(R.layout.fragment_movie_detail,
container, false);
return contentView:
}
For some reason the Fragment keeps the old theme..
Edit
So basically the question comes down to: How do you make an Actionbar transparent (and overlay mode) in just one fragment of an activity?