title: Create new line inside Linear Layout
body: <p><a href="https://photos.google.com/share/AF1QipN8CMwXwKf_8AJtaclkZTq-iDy8TtLzjSFc-pq5RFwyB05KiQUUozHhtez7Q1gxfA?key=ZlhTS1hYWEc0amZUeUpoTU1PS1pXVm1OQjhDRkd3" rel="nofollow noreferrer">References Image</a></p>
  
  <p><strong>What I want:</strong> dynamically add the image inside the box and if a line is complete then add it to new line.</p>
  
  <p><strong>WHere I am currently:</strong> I am able to add the image inside the linear layout, if no of image is greater than the block width then remaining image will not shown. </p>
  
  <p><strong>What is the issue:</strong> Since I am adding to the linear layout and I am not telling the layout where I should be added. SO it add at the end of the row. </p>
  
  <p><strong>Solution Tried:</strong> :</p>
  
  <p>I have added the gridview with the 3 column inside the linear layout.But in this approach, I am able to figure about how to calculate the position where I add image. Since in grid view we can't find the position of last item filled. 
  One more problem with this approach I need to track last item position. </p>
  
  <p>xml code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.design.widget.CoordinatorLayout
      android:id="@+id/relativeView"
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      xmlns:app="http://schemas.android.com/apk/res-auto"&gt;
  
      &lt;android.support.v7.widget.Toolbar
          android:id="@+id/toolbar"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
      &lt;/android.support.v7.widget.Toolbar&gt;
  
      &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:paddingTop="@dimen/activity_horizontal_margin"
          android:paddingLeft="@dimen/activity_horizontal_margin"
          android:paddingRight="@dimen/activity_horizontal_margin"
          android:layout_marginTop="?attr/actionBarSize"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical" &gt;
  
          &lt;LinearLayout
  
              android:weightSum="2"
              android:orientation="horizontal"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"&gt;
  
              &lt;TextView
                  android:textStyle="bold"
                  android:textColor="@color/green"
                  android:gravity="center_horizontal"
                  android:layout_weight="1"
                  android:text="Morning"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent" /&gt;
  
              &lt;TextView
                  android:textStyle="bold"
                  android:textColor="@color/green"
                  android:gravity="center_horizontal"
                  android:layout_weight="1"
                  android:text="Afternoon"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent" /&gt;
  
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_weight="1.0"
              android:orientation="horizontal" &gt;
  
              &lt;LinearLayout
                  android:layout_marginBottom="@dimen/activity_vertical_margin"
                  android:layout_marginEnd="@dimen/activity_vertical_margin"
                  android:background="@drawable/rectangle_curve"
                  android:orientation="horizontal"
                  android:padding="@dimen/activity_vertical_margin"
                  android:id="@+id/ll1"
                  android:layout_width="match_parent"
                   android:layout_height="match_parent"
                  android:layout_weight="1.0"&gt;
  
                 &lt;!-- &lt;GridView
                      android:layout_weight="1.0"
                      android:layout_marginTop="@dimen/cardview_default_elevation"
                      android:orientation="horizontal"
                      android:layout_marginBottom="@dimen/activity_vertical_margin"
                      android:layout_marginEnd="@dimen/activity_vertical_margin"
                      android:background="@drawable/rectangle_curve"
                      android:horizontalSpacing="10dp"
                      android:verticalSpacing="10dp"
                      android:numColumns="auto_fit"
                      android:id="@+id/gv1"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"&gt;
                      &lt;/GridView&gt;--&gt;
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:layout_marginBottom="@dimen/activity_vertical_margin"
                  android:layout_marginStart="@dimen/activity_vertical_margin"
                  android:background="@drawable/rectangle_curve"
                  android:padding="@dimen/activity_vertical_margin"
                  android:orientation="horizontal"
                  android:id="@+id/ll2"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:layout_weight="1.0"&gt;
  
                  &lt;!--&lt;GridView
                      android:layout_weight="1.0"
                      android:layout_marginTop="@dimen/cardview_default_elevation"
                      android:orientation="horizontal"
                      android:layout_marginBottom="@dimen/activity_vertical_margin"
                      android:layout_marginEnd="@dimen/activity_vertical_margin"
  
                      android:background="@drawable/rectangle_curve"
                      android:horizontalSpacing="10dp"
                      android:verticalSpacing="10dp"
                      android:numColumns="auto_fit"
                      android:id="@+id/gv2"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"&gt;
                  &lt;/GridView&gt;
  --&gt;
  
              &lt;/LinearLayout&gt;
  
  
           &lt;/LinearLayout&gt;
  
  
          &lt;LinearLayout
              android:weightSum="2"
              android:orientation="horizontal"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"&gt;
  
              &lt;TextView
                  android:textStyle="bold"
                  android:textColor="@color/green"
                  android:gravity="center_horizontal"
                  android:layout_weight="1"
                  android:text="Evening"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent" /&gt;
  
              &lt;TextView
                  android:textStyle="bold"
                  android:textColor="@color/green"
                  android:gravity="center_horizontal"
                  android:layout_weight="1"
                  android:text="Night"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent" /&gt;
  
          &lt;/LinearLayout&gt;
  
  
  
      &lt;LinearLayout
          android:weightSum="2"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_weight="1.0"
          android:orientation="horizontal" &gt;
  
          &lt;LinearLayout
              android:layout_marginBottom="@dimen/activity_vertical_margin"
              android:layout_marginEnd="@dimen/activity_vertical_margin"
              android:orientation="horizontal"
              android:padding="@dimen/activity_vertical_margin"
              android:background="@drawable/rectangle_curve"
              android:id="@+id/ll3"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_weight="1.0"&gt;
  
  &lt;!--
          &lt;GridView
              android:layout_weight="1.0"
              android:layout_marginTop="@dimen/cardview_default_elevation"
              android:orientation="horizontal"
              android:layout_marginBottom="@dimen/activity_vertical_margin"
              android:layout_marginEnd="@dimen/activity_vertical_margin"
  
              android:background="@drawable/rectangle_curve"
              android:horizontalSpacing="10dp"
              android:verticalSpacing="10dp"
              android:numColumns="auto_fit"
              android:id="@+id/gv3"
              android:layout_width="match_parent"
              android:layout_height="match_parent"&gt;
          &lt;/GridView&gt;--&gt;
  
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:background="@drawable/rectangle_curve"
                  android:layout_marginStart="@dimen/activity_vertical_margin"
                  android:layout_marginBottom="@dimen/activity_vertical_margin"
                  android:orientation="horizontal"
                  android:id="@+id/ll4"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:layout_weight="1.0"&gt;
  
  
             &lt;!-- &lt;GridView
              android:layout_weight="1.0"
              android:layout_marginTop="@dimen/cardview_default_elevation"
              android:orientation="horizontal"
              android:layout_marginBottom="@dimen/activity_vertical_margin"
              android:layout_marginEnd="@dimen/activity_vertical_margin"
              android:background="@drawable/rectangle_curve"
              android:horizontalSpacing="10dp"
              android:verticalSpacing="10dp"
              android:numColumns="auto_fit"
              android:id="@+id/gv4"
              android:layout_width="match_parent"
              android:layout_height="match_parent"&gt;
          &lt;/GridView&gt;
  --&gt;
                  &lt;/LinearLayout&gt;
  
  
          &lt;/LinearLayout&gt;
  
  
  &lt;/LinearLayout&gt;
  
      &lt;android.support.design.widget.FloatingActionButton
          android:layout_marginEnd="@dimen/activity_horizontal_margin"
          android:id="@+id/fab_add_reminders"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:src="@drawable/ic_action_add"
          app:backgroundTint="@color/white"
          android:layout_gravity="bottom|end" /&gt;
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>