+ --------------------------------------------------------------+         
|   this code is for image fragment_exercise.png                |
|                                                               |
+ --------------------------------------------------------------+ 


right click on com.example.fragments (inside java folder (1st folder)) -> new ->activity -> empty activity (name as LikeFragment.kt,ContentFragment.kt)


=============================================
activity_main.xml
=============================================

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <fragment
        android:name="com.example.cie3_frag_exercise.LikeFragment" 
        android:id="@+id/likeFragment"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <fragment
        android:name="com.example.cie3_frag_exercise.ContentFragment"
        android:id="@+id/contentFragment"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" />
</LinearLayout>

=============================================
fragment_like.xml
=============================================


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:padding="8dp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#FDD835">

    <TextView
        android:text="ARTICLE: Like"
        android:textSize="18sp"
        android:textStyle="bold"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <RadioGroup
        android:orientation="horizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <RadioButton android:text="Yes" />
        <RadioButton android:text="No" />
    </RadioGroup>

    <TextView
        android:text="LIKE THE SONG?"
        android:layout_marginTop="6dp"
        android:textSize="16sp"
        android:textStyle="bold"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <RatingBar
        android:numStars="5"
        android:stepSize="1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
</LinearLayout>

=============================================
fragment_content.xml
=============================================


<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:orientation="vertical"
        android:padding="16dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageView
            android:src="@drawable/img"
            android:layout_width="100dp"
            android:layout_height="150dp"
            android:layout_gravity="center" />

        <TextView
            android:text="Cry for a Shadow"
            android:textSize="20sp"
            android:textStyle="bold"
            android:layout_marginTop="8dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <TextView
            android:text="Many a Beatle fanatic started down the outtake road, like I did..."
            android:layout_marginTop="4dp"
            android:textSize="15sp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </LinearLayout>
</ScrollView>

=============================================
MainActivity.kt
=============================================


import android.app.Activity
import android.os.Bundle

class MainActivity : Activity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
    }
}


=============================================
LikeFragment.kt
=============================================

import android.app.Fragment
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup

class LikeFragment : Fragment() {
    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
    ): View? {
        return inflater.inflate(R.layout.fragment_like, container, false)
    }
}

=============================================
ContentFragment.kt
=============================================

import android.app.Fragment
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup

class ContentFragment : Fragment() {
    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
    ): View? {
        return inflater.inflate(R.layout.fragment_content, container, false)
    }
}