fix home fragment layout

This commit is contained in:
shaulascr
2025-02-02 16:20:47 +07:00
parent 6bf3556fed
commit 66ced66eda
3 changed files with 41 additions and 7 deletions

View File

@ -5,20 +5,28 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
tools:context=".ui.MainActivity">
<!-- NavHostFragment -->
<androidx.fragment.app.FragmentContainerView
android:id="@+id/nav_host_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toTopOf="@id/bottom_navigation"
android:name="androidx.navigation.fragment.NavHostFragment"
app:defaultNavHost="true"
app:navGraph="@navigation/nav_graph" />
<com.google.android.material.divider.MaterialDivider
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
app:dividerColor="@color/gray_1"
app:layout_constraintBottom_toTopOf="@id/bottom_navigation" />
<!-- BottomNavigationView -->
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation"

View File

@ -9,8 +9,7 @@
<ScrollView
android:id="@+id/home"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent">
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
@ -85,15 +84,41 @@
tools:layout_editor_absoluteX="0dp"
tools:listitem="@layout/item_category_home" />
<TextView
android:id="@+id/new_products_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="24dp"
android:text="@string/new_products_text"
android:textColor="@color/dark"
android:textSize="22sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/categories" />
<com.google.android.material.button.MaterialButton
android:id="@+id/productshowAll"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:text="@string/show_all"
android:textAllCaps="false"
android:textColor="@color/blue1"
android:textSize="16sp"
app:layout_constraintBaseline_toBaselineOf="@id/new_products_text"
app:layout_constraintEnd_toEndOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/new_products"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="39dp"
android:layout_marginBottom="32dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintTop_toBottomOf="@id/categories"
app:layout_constraintTop_toBottomOf="@id/new_products_text"
tools:itemCount="5"
tools:listitem="@layout/item_section_horizontal" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -11,4 +11,5 @@
<string name="item_price_txt">Rp%.1f</string>
<string name="retry">Coba lagi\n</string>
<string name="error_loading">Terdapat error...</string>
<string name="new_products_text">Produk Terbaru</string>
</resources>