In my case, the solution was a bit tricky and funny. I had a RelativeLayout
with a TextView
and a ProgressBar
. The Progressbar
sits on top of the TextView
, like so:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1"
tools:context="com.caoa.yakokoe.yakokoe.ui.splash.SplashActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.5">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:contentDescription="@string/content_desc_logo_green"
android:src="@drawable/logo_green" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.5">
<ProgressBar
android:id="@+id/splash_progress_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/splash_text"
android:layout_centerHorizontal="true"
android:indeterminate="true"
android:visibility="gone" />
<TextView
android:id="@+id/splash_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="24dp"
android:layout_marginTop="16dp"
android:text="@string/splash_text_default"
android:textAlignment="center"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>
This threw a sort of error (forgotten what it was, but it was in the lines of 'cannot find id of layout_above').
The solution was simply to flip the ProgressBar
and TextView
Locations, like so:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1"
tools:context="com.caoa.yakokoe.yakokoe.ui.splash.SplashActivity">
<!-- Content here -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.5">
<TextView
android:id="@+id/splash_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="24dp"
android:layout_marginTop="16dp"
android:text="@string/splash_text_default"
android:textAlignment="center"
android:visibility="gone" />
<ProgressBar
android:id="@+id/splash_progress_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/splash_text"
android:layout_centerHorizontal="true"
android:indeterminate="true"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>