Fragments in a viewpager not being themed properly.
ItsCalebJones opened this issue · 2 comments
I have three fragments in a FragmentStatePagerAdapter almost done exactly like the demo project, however none of the fragments are theming properly. The parent activity is themed properly and the primary and accent colors are working however the ?backgroundColor attribute is not.
<com.google.android.material.card.MaterialCardView
android:id="@+id/summary_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/material_card_edge_margin"
android:animateLayoutChanges="true"
android:padding="@dimen/material_card_edge_margin"
android:visibility="visible"
app:cardBackgroundColor="?backgroundColor"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="@dimen/material_card_elevation_resting"
card_view:cardPreventCornerOverlap="true"
card_view:cardUseCompatPadding="true">
It seems to be very similar to #41 where at runtime calling getCyanea() can return the correct colors which means I could manually set the colors for each view, however that defeats the purpose of a clean library.
Notice cardBackground is using correct dark styling:
Now a fragment inside the viewpager is not using correct dark styling:
From the fragment if I call the getBackground I can then set that color, but I'd also need to set all textViews as they are not being styled properly either.
Ok i've somewhat reproduced the issue in the demo app:
Setup: Build the app and change the theme around.
- Launch the app
- Tap the Chipgroup to start the DupMainActivity
- Card background color which is set via the ?backgroundColor attribute should always match the view that is colored at runtime.
Actual Results:
Occasionally - the cards view is some other color.
Any chance this could get looked at? As an explanation - the entire Background Color card in the screenshot above should be #00000 however the card is rendered with the default dark color.