Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,22 @@

import android.widget.ImageView;

import com.google.android.material.tabs.TabLayout;

public class Splash1Activity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash1);

// Set the first tab as selected
TabLayout tabLayout = findViewById(R.id.tabLayout);
TabLayout.Tab tab = tabLayout.getTabAt(0);
if (tab != null) {
tab.select();
}

// when you click arrow it will go to Splash2Activity
ImageView nextArrow = findViewById(R.id.nextArrow1);
nextArrow.setOnClickListener(v -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,22 @@

import androidx.appcompat.app.AppCompatActivity;

import com.google.android.material.tabs.TabLayout;

public class Splash2Activity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash2);

// Set the second tab as selected
TabLayout tabLayout = findViewById(R.id.tabLayout);
TabLayout.Tab tab = tabLayout.getTabAt(1);
if (tab != null) {
tab.select();
}

ImageView nextArrow = findViewById(R.id.nextArrow2);

// when you click arrow it will go to MainActivity
Expand Down
11 changes: 10 additions & 1 deletion app/src/main/res/layout/activity_splash1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,16 @@
app:tabGravity="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
app:layout_constraintEnd_toEndOf="parent">

<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

</com.google.android.material.tabs.TabLayout>

<ImageView
android:id="@+id/nextArrow1"
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/res/layout/activity_splash2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,16 @@
app:layout_constraintWidth_percent="0.7" />

<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginBottom="24dp"
android:layout_marginBottom="32dp"
app:tabBackground="@drawable/tab_selector"
app:tabIndicatorHeight="0dp"
app:tabGravity="center"

app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="MissingConstraints">
app:layout_constraintEnd_toEndOf="parent">

<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
Expand All @@ -68,12 +67,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/arrow_forward"
android:color="#4c4c4c"
android:padding="8dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="24dp"
android:layout_marginEnd="16dp"
android:contentDescription="forward arrow"

app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
app:layout_constraintBottom_toBottomOf="@+id/tabLayout"
app:layout_constraintTop_toTopOf="@+id/tabLayout" />

</androidx.constraintlayout.widget.ConstraintLayout>
Loading