Challenge - 1: Restoring CrimeFragment's Margins


#1

Since the book prompted that layout params non-existence in the case of ViewPagers, I used padding and this was fixed. Is this the only solution or are there alternatives :thinking:?


#2

I think it really works good. I used the same solution.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="16dp"
    android:orientation="vertical"
    >

#3

When i was creating fragment_crime.xml, i accidentally created Constraint Layout, so i just put Linear layout in and added:
android:layout_marginBottom=“16dp”
android:layout_marginEnd=“16dp”
android:layout_marginStart=“16dp”
android:layout_marginTop=“16dp”
app:layout_constraintBottom_toBottomOf=“parent”
app:layout_constraintEnd_toEndOf=“parent”
app:layout_constraintStart_toStartOf=“parent”
app:layout_constraintTop_toTopOf=“parent”


#4

I created one more linearlayout outside the current linearlayout.
So my solution is:
<LinearLayout xmlns:android=“http://schemas.android.com/apk/res/android
android:layout_width=“match_parent”
android:layout_height=“match_parent”
android:orientation=“vertical”>

<LinearLayout
android:layout_width=“match_parent”
android:layout_height=“match_parent”
android:layout_margin=“16dp”
android:orientation=“vertical”>

----//----

</LinearLayout>