When I move from activity using ScrollView, I return to it, ScrollView turns black. When starting, the colors are correct. It's just that when I leave and return, it turns black. I tried to set the ScrollView background and internal LinearLayouts, but that does not make any difference. ScrollView is pumped up by a fragment in ViewPager if it matters.
Any ideas why this could be so?
Here is the XML
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scroll_formatted" android:layout_width="match_parent" android:layout_height="wrap_content" android:clickable="false" android:focusable="false" android:focusableInTouchMode="false"> <LinearLayout style="@style/LinearLayoutVertical"> <ImageView android:id="@+id/image_formatted" android:layout_width="match_parent" android:layout_height="wrap_content" android:contentDescription="@string/image_review_cd" android:scaleType="centerCrop"/> <LinearLayout style="@style/LinearLayoutVertical.WrappedVertical" android:id="@+id/subject_rating_formatted"> <TextView android:id="@+id/subject_formatted" style="@style/TextView.Subject.Bold" android:background="?darkBackground"/> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="?darkBackground"> <RatingBar android:id="@+id/rating_formatted" style="@style/RatingBarFiveStar.Indicator.PointOneStep" android:background="?darkBackground"/> </FrameLayout> <TextView android:id="@+id/stamp_formatted" style="@style/FormattedText.Stamp" android:background="?darkBackground"/> </LinearLayout> <TextView android:id="@+id/headline_formatted" style="@style/TextView.Headline"/> <TextView android:id="@+id/tags_formatted" style="@style/FormattedTitleValue"/> <include android:id="@+id/comment_formatted" layout="@layout/formatted_title_value"/> <include android:id="@+id/locations_formatted" layout="@layout/formatted_title_value"/> <include android:id="@+id/criteria_formatted" layout="@layout/formatted_title_value"/> <include android:id="@+id/facts_formatted" layout="@layout/formatted_title_value"/> <include android:id="@+id/images_formatted" layout="@layout/formatted_title_data"/> </LinearLayout> </ScrollView>
Edit: here is the activity and fragment:
activity
public class ActivityFormatReview extends FragmentActivity implements LaunchableUi, OptionSelectListener, FormattedPagerAdapter.FragmentsObserver { private static final String TAG = TagKeyGenerator.getTag(ActivityFormatReview.class); private static final String RETAIN_VIEW = TagKeyGenerator.getKey(ActivityFormatReview.class, "RetainView"); private static final int LAYOUT = R.layout.view_pager; private static final int PAGER = R.id.pager; private FormattedPagerAdapter mAdapter; private ViewPager mPager; private FragmentInitialiser mInitialiser; public ReviewNode getNode(ReviewId id) { return mAdapter.getNode(id); } public void remove(FragmentFormatReview fragment) { mAdapter.removeFragment(fragment); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(LAYOUT); Bundle args = getIntent().getBundleExtra(getLaunchTag()); if (args == null) throwNoReview(); AppInstanceAndroid app = AppInstanceAndroid.getInstance(this); ReviewNode node = app.unpackNode(args); if (node == null) throwNoReview(); boolean isPublished = NodeLauncher.isPublished(args); mPager = findViewById(PAGER); mAdapter = new FormattedPagerAdapter(node, new NodeComparatorMostRecent(), getSupportFragmentManager(), this, isPublished); mPager.setAdapter(mAdapter); mInitialiser = new FragmentInitialiser(app.getUi()); mPager.addOnLayoutChangeListener(mInitialiser); mPager.addOnPageChangeListener(mInitialiser); } @Override public void onNoFragmentsLeft() { finish(); } @Override public void updateTitle(String title) { mInitialiser.setTitle(title); } @Override protected void onDestroy() { super.onDestroy(); mAdapter.detach(); } @Override public void onSaveInstanceState(Bundle outState) { outState.putBoolean(RETAIN_VIEW, true); super.onSaveInstanceState(outState); } @Override public String getLaunchTag() { return TAG; } @Override public void launch(UiTypeLauncher launcher) { launcher.launch(getClass(), getLaunchTag()); } @Override public boolean onOptionSelected(int requestCode, String option) { FragmentFormatReview fragment = getVisibleFragment(); return fragment != null && fragment.onOptionSelected(requestCode, option); } @Override public boolean onOptionsCancelled(int requestCode) { FragmentFormatReview fragment = getVisibleFragment(); return fragment != null && fragment.onOptionsCancelled(requestCode); } @Override protected void onResume() { super.onResume(); AppInstanceAndroid.setActivity(this); } @Nullable private FragmentFormatReview getVisibleFragment() { return mAdapter.getFragment(mPager.getCurrentItem()); } private void throwNoReview() { throw new RuntimeException("No review found"); } private class FragmentInitialiser implements ViewPager.OnLayoutChangeListener, ViewPager .OnPageChangeListener { private UiSuite mUi; private FragmentInitialiser(UiSuite ui) { mUi = ui; } @Override public void onLayoutChange(View view, int i, int i1, int i2, int i3, int i4, int i5, int i6, int i7) { setTitle(); } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { setTitle(); } @Override public void onPageScrollStateChanged(int state) { } private void setTitle() { FragmentFormatReview fragment = getVisibleFragment(); if (fragment != null) { setTitle(fragment.isPublished() ? mAdapter.getTitle(fragment) : Strings.Screens.PREVIEW); } } private void setTitle(String title) { mUi.getCurrentScreen().setTitle(title); } } }
Fragment
public class FragmentFormatReview extends PagerAdapterBasic.PageableFragment implements ReviewNode.NodeObserver, DataReference.InvalidationListener, OptionSelectListener { private static final String ID = TagKeyGenerator.getKey(FragmentFormatReview.class, "ReviewId"); private static final String PUBLISHED = TagKeyGenerator.getKey(FragmentFormatReview.class, "published"); private static final int LAYOUT = R.layout.fragment_review_formatted; private static final int IMAGE = R.id.image_formatted; private static final int SUBJECT = R.id.subject_formatted; private static final int RATING = R.id.rating_formatted; private static final int HEADLINE = R.id.headline_formatted; private static final int STAMP = R.id.stamp_formatted; private static final int COMMENT = R.id.comment_formatted; private static final int TAGS = R.id.tags_formatted; private static final int CRITERIA = R.id.criteria_formatted; private static final int FACTS = R.id.facts_formatted; private static final int LOCATIONS = R.id.locations_formatted; private static final int IMAGES = R.id.images_formatted; private static final int DATA = R.id.section_data; private static final int IMAGE_PADDING = R.dimen.formatted_image_padding; private static final int IMAGE_PLACEHOLDER = R.drawable.image_placeholder; private static final ReviewViewParams.CellDimension FULL = ReviewViewParams.CellDimension.FULL; private static final ReviewViewParams.CellDimension HALF = ReviewViewParams.CellDimension.HALF; private boolean mIsPublished = true; private ReviewNode mNode; private UiSuite mUi; private RepositorySuite mRepo; private MenuUi mMenu; private CoverNodeBannerUi mCover; private ViewUi<TextView, String> mSubject; private ViewUi<RatingBar, Float> mRating; private ViewUi<TextView, RefDataList<DataTag>> mTags; private ViewUi<TextView, AuthorReference> mStamp; private FormattedSectionUi<RefCommentList> mComment; private FormattedSectionUi<RefDataList<DataCriterion>> mCriteria; private FormattedSectionUi<RefDataList<DataFact>> mFacts; private FormattedSectionUi<RefDataList<DataLocation>> mLocations; private FormattedSectionUi<ReviewItemReference<DataSize>> mImages; public static FragmentFormatReview newInstance(String nodeId, boolean isPublished) {
Edit 2: here is the manifest entry:
<activity android:name=".ApplicationPlugins.PlugIns.UiPlugin.UiAndroid.Implementation.Act ivities.ActivityFormatReview" android:configChanges="orientation" android:exported="true" android:screenOrientation="portrait" android:windowSoftInputMode="adjustPan" > </activity>