I’ve got a small issue, I’m learning to use Android with Java programming language. So far I’ve managed to add a scroll system, some pictures and a slideshow of images. I’m trying to add a navigation bar at the bottom however I think it is appearing behind the scrollView. I’m not sure if I’ve coded it wrong or it has to be in a specific order, some advice would be appreciated. I’ve also noticed my Constraint Widget disappeared for bottomNavigationView.
activity_main.xml
<code><?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<FrameLayout
android:layout_width="0sp"
android:layout_height="0sp"
app:layout_constraintBottom_toTopOf="@+id/bottomNavigationView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</FrameLayout>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/bottom_nav_menu" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.denzcoskun.imageslider.ImageSlider
android:id="@+id/image_slider"
android:layout_width="wrap_content"
android:layout_height="300dp"
app:iss_auto_cycle="true"
app:iss_delay="1000"
app:iss_period="1000"
app:iss_text_align="CENTER" />
<!-- Title -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="16dp"
android:text="Museums and Culture of Wales"
android:textSize="24sp"
android:textStyle="bold" />
<!-- National Museum Cardiff -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="4dp"
android:text="1. National Museum Cardiff: Located in the capital city, this museum houses an incredible collection of art, archaeology, and natural history. It’s a must-visit for anyone interested in exploring the artistic and scientific achievements of Wales."
android:textSize="16sp" />
<ImageView
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:scaleType="centerCrop"
android:src="@drawable/img1" />
<!-- St Fagans National Museum of History -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="4dp"
android:text="2. St Fagans National Museum of History: A unique open-air museum near Cardiff that features over forty original buildings from different historical periods in Welsh history. It provides a vivid picture of life in Wales over centuries."
android:textSize="16sp" />
<ImageView
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:scaleType="centerCrop"
android:src="@drawable/img2" />
<!-- Big Pit National Coal Museum -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="4dp"
android:text="3. Big Pit National Coal Museum: This UNESCO World Heritage Site in Blaenavon lets you explore the life of coal miners with a guided underground tour. It’s a fascinating way to learn about Wales' industrial heritage."
android:textSize="16sp" />
<ImageView
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:scaleType="centerCrop"
android:src="@drawable/img3" />
<!-- Pontcysyllte Aqueduct -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="4dp"
android:text="4. Pontcysyllte Aqueduct: Not a museum but a cultural icon, this aqueduct is a masterpiece of engineering and a UNESCO World Heritage Site. It’s a testament to Wales’ contributions to industrial innovation."
android:textSize="16sp" />
<ImageView
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:scaleType="centerCrop"
android:src="@drawable/img4" />
<!-- Closing Paragraph -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="4dp"
android:text="Wales is also celebrated for its music, language, and festivals. The Eisteddfod, an annual cultural festival, showcases the best in Welsh poetry, music, and art, while the Welsh language (Cymraeg) remains an integral part of the country's identity. Whether you’re visiting its museums or experiencing its vibrant culture firsthand, Wales offers an unforgettable journey into the past and present."
android:textSize="16sp" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
</code>
<code><?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<FrameLayout
android:layout_width="0sp"
android:layout_height="0sp"
app:layout_constraintBottom_toTopOf="@+id/bottomNavigationView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</FrameLayout>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/bottom_nav_menu" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.denzcoskun.imageslider.ImageSlider
android:id="@+id/image_slider"
android:layout_width="wrap_content"
android:layout_height="300dp"
app:iss_auto_cycle="true"
app:iss_delay="1000"
app:iss_period="1000"
app:iss_text_align="CENTER" />
<!-- Title -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="16dp"
android:text="Museums and Culture of Wales"
android:textSize="24sp"
android:textStyle="bold" />
<!-- National Museum Cardiff -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="4dp"
android:text="1. National Museum Cardiff: Located in the capital city, this museum houses an incredible collection of art, archaeology, and natural history. It’s a must-visit for anyone interested in exploring the artistic and scientific achievements of Wales."
android:textSize="16sp" />
<ImageView
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:scaleType="centerCrop"
android:src="@drawable/img1" />
<!-- St Fagans National Museum of History -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="4dp"
android:text="2. St Fagans National Museum of History: A unique open-air museum near Cardiff that features over forty original buildings from different historical periods in Welsh history. It provides a vivid picture of life in Wales over centuries."
android:textSize="16sp" />
<ImageView
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:scaleType="centerCrop"
android:src="@drawable/img2" />
<!-- Big Pit National Coal Museum -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="4dp"
android:text="3. Big Pit National Coal Museum: This UNESCO World Heritage Site in Blaenavon lets you explore the life of coal miners with a guided underground tour. It’s a fascinating way to learn about Wales' industrial heritage."
android:textSize="16sp" />
<ImageView
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:scaleType="centerCrop"
android:src="@drawable/img3" />
<!-- Pontcysyllte Aqueduct -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="4dp"
android:text="4. Pontcysyllte Aqueduct: Not a museum but a cultural icon, this aqueduct is a masterpiece of engineering and a UNESCO World Heritage Site. It’s a testament to Wales’ contributions to industrial innovation."
android:textSize="16sp" />
<ImageView
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:scaleType="centerCrop"
android:src="@drawable/img4" />
<!-- Closing Paragraph -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="4dp"
android:text="Wales is also celebrated for its music, language, and festivals. The Eisteddfod, an annual cultural festival, showcases the best in Welsh poetry, music, and art, while the Welsh language (Cymraeg) remains an integral part of the country's identity. Whether you’re visiting its museums or experiencing its vibrant culture firsthand, Wales offers an unforgettable journey into the past and present."
android:textSize="16sp" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
</code>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<FrameLayout
android:layout_width="0sp"
android:layout_height="0sp"
app:layout_constraintBottom_toTopOf="@+id/bottomNavigationView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</FrameLayout>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/bottom_nav_menu" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.denzcoskun.imageslider.ImageSlider
android:id="@+id/image_slider"
android:layout_width="wrap_content"
android:layout_height="300dp"
app:iss_auto_cycle="true"
app:iss_delay="1000"
app:iss_period="1000"
app:iss_text_align="CENTER" />
<!-- Title -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="16dp"
android:text="Museums and Culture of Wales"
android:textSize="24sp"
android:textStyle="bold" />
<!-- National Museum Cardiff -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="4dp"
android:text="1. National Museum Cardiff: Located in the capital city, this museum houses an incredible collection of art, archaeology, and natural history. It’s a must-visit for anyone interested in exploring the artistic and scientific achievements of Wales."
android:textSize="16sp" />
<ImageView
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:scaleType="centerCrop"
android:src="@drawable/img1" />
<!-- St Fagans National Museum of History -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="4dp"
android:text="2. St Fagans National Museum of History: A unique open-air museum near Cardiff that features over forty original buildings from different historical periods in Welsh history. It provides a vivid picture of life in Wales over centuries."
android:textSize="16sp" />
<ImageView
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:scaleType="centerCrop"
android:src="@drawable/img2" />
<!-- Big Pit National Coal Museum -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="4dp"
android:text="3. Big Pit National Coal Museum: This UNESCO World Heritage Site in Blaenavon lets you explore the life of coal miners with a guided underground tour. It’s a fascinating way to learn about Wales' industrial heritage."
android:textSize="16sp" />
<ImageView
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:scaleType="centerCrop"
android:src="@drawable/img3" />
<!-- Pontcysyllte Aqueduct -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="4dp"
android:text="4. Pontcysyllte Aqueduct: Not a museum but a cultural icon, this aqueduct is a masterpiece of engineering and a UNESCO World Heritage Site. It’s a testament to Wales’ contributions to industrial innovation."
android:textSize="16sp" />
<ImageView
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:scaleType="centerCrop"
android:src="@drawable/img4" />
<!-- Closing Paragraph -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="4dp"
android:text="Wales is also celebrated for its music, language, and festivals. The Eisteddfod, an annual cultural festival, showcases the best in Welsh poetry, music, and art, while the Welsh language (Cymraeg) remains an integral part of the country's identity. Whether you’re visiting its museums or experiencing its vibrant culture firsthand, Wales offers an unforgettable journey into the past and present."
android:textSize="16sp" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
bottom_nav_menu.xml
<code> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/home"
android:title="Home"
app:actionProviderClass="androidx.mediarouter.app.MediaRouteActionProvider"
tools:icon="@drawable/ic_home" />
<item
android:id="@+id/maps"
android:title="Maps"
app:actionProviderClass="androidx.mediarouter.app.MediaRouteActionProvider"
tools:icon="@drawable/ic_maps" />
<item
android:id="@+id/details"
android:title="Details"
app:actionProviderClass="androidx.mediarouter.app.MediaRouteActionProvider"
tools:icon="@drawable/ic_detail" />
<item
android:id="@+id/settings"
android:title="Settings"
app:actionProviderClass="androidx.mediarouter.app.MediaRouteActionProvider"
tools:icon="@drawable/ic_setting" />
</menu>
</code>
<code> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/home"
android:title="Home"
app:actionProviderClass="androidx.mediarouter.app.MediaRouteActionProvider"
tools:icon="@drawable/ic_home" />
<item
android:id="@+id/maps"
android:title="Maps"
app:actionProviderClass="androidx.mediarouter.app.MediaRouteActionProvider"
tools:icon="@drawable/ic_maps" />
<item
android:id="@+id/details"
android:title="Details"
app:actionProviderClass="androidx.mediarouter.app.MediaRouteActionProvider"
tools:icon="@drawable/ic_detail" />
<item
android:id="@+id/settings"
android:title="Settings"
app:actionProviderClass="androidx.mediarouter.app.MediaRouteActionProvider"
tools:icon="@drawable/ic_setting" />
</menu>
</code>
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/home"
android:title="Home"
app:actionProviderClass="androidx.mediarouter.app.MediaRouteActionProvider"
tools:icon="@drawable/ic_home" />
<item
android:id="@+id/maps"
android:title="Maps"
app:actionProviderClass="androidx.mediarouter.app.MediaRouteActionProvider"
tools:icon="@drawable/ic_maps" />
<item
android:id="@+id/details"
android:title="Details"
app:actionProviderClass="androidx.mediarouter.app.MediaRouteActionProvider"
tools:icon="@drawable/ic_detail" />
<item
android:id="@+id/settings"
android:title="Settings"
app:actionProviderClass="androidx.mediarouter.app.MediaRouteActionProvider"
tools:icon="@drawable/ic_setting" />
</menu>
3