Android bottom sheet behavior not working properly.Views not show on first run
<p>Good day i have an app with bottom sheet behavior support.No matter what i have tried,the bottom sheet will not show the elements inside it on first initial show of it.The second time the same code triggers,the bottom sheet shows the element.This is happening with both:dynamically added views and listview as well.Here is my xml constructed for bottom sheet.</p>

<pre><code>&lt;android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"&gt;

&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"&gt;


    &lt;fragment xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:map="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context="brijhelpline.testproject.MapsActivity" /&gt;

    &lt;android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:alpha="0.9"
        android:background="@drawable/gradient"&gt;

        &lt;RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"&gt;

            &lt;ProgressBar
                android:id="@+id/progressBar"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_below="@+id/settings"
                android:indeterminate="false"
                android:visibility="gone" /&gt;

            &lt;ImageView
                android:id="@+id/userIcon"
                android:layout_width="38dp"
                android:layout_height="38dp"
                android:layout_alignParentLeft="true"
                android:layout_marginTop="13dp"
                android:background="@drawable/user" /&gt;

            &lt;ImageView
                android:id="@+id/settings"
                android:layout_width="38dp"
                android:layout_height="38dp"
                android:layout_alignParentRight="true"
                android:layout_marginRight="3dp"
                android:layout_marginTop="10dp"
                android:background="@drawable/settings_icon" /&gt;

            &lt;TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="20dp"
                android:text="Fuel Buddy"
                android:textColor="#ffffff"
                android:textSize="20sp" /&gt;
        &lt;/RelativeLayout&gt;
    &lt;/android.support.v7.widget.Toolbar&gt;

    &lt;RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/toolbar"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:background="@drawable/searc_layout"&gt;

        &lt;ImageView
            android:id="@+id/marker"
            android:layout_width="20dp"
            android:layout_height="30dp"
            android:layout_alignParentLeft="true"
            android:layout_margin="10dp"
            android:background="@drawable/marker_icon" /&gt;

        &lt;ImageView
            android:id="@+id/add"
            android:layout_width="25dp"
            android:layout_height="26dp"
            android:layout_alignParentRight="true"
            android:layout_margin="10dp"
            android:background="@drawable/add_icon" /&gt;

        &lt;EditText
            android:id="@+id/inputStation"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:layout_toLeftOf="@+id/add"
            android:layout_toRightOf="@+id/marker"
            android:hint="Поиск Заправки"
            android:maxLines="1" /&gt;
    &lt;/RelativeLayout&gt;


&lt;/RelativeLayout&gt;

&lt;android.support.v4.widget.NestedScrollView
    android:id="@+id/bottom_sheet"
    android:layout_width="match_parent"
    android:layout_height="300dp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:background="@android:color/white"
    android:clipToPadding="true"
    app:layout_behavior="android.support.design.widget.BottomSheetBehavior"&gt;

    &lt;LinearLayout
        android:id="@+id/layoutToAdd"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"&gt;

    &lt;/LinearLayout&gt;
    &lt;!--&lt;ListView--&gt;
    &lt;!--android:id="@+id/listView"--&gt;
    &lt;!--android:layout_width="match_parent"--&gt;
    &lt;!--android:layout_height="match_parent"&gt;&lt;/ListView&gt;--&gt;
&lt;/android.support.v4.widget.NestedScrollView&gt;
</code></pre>

<p></p>

<p>As you can see the listview is commited,so i tried with every possible ways,even replacing the NESTEDSCROLLVIEW with RELATIVELAYOUT or whatsoever.And here is the code which actually adds view to the linearLayout.</p>

<pre><code>     for (int i = 0; i &lt; loopContent; i++) {
                    String address = addresses.get(i).getAddressLine(0); // If any additional address line present than only, check with max available address lines by getMaxAddressLineIndex()
                    String city = addresses.get(i).getLocality();
                    String state = addresses.get(i).getAdminArea();
                    String country = addresses.get(i).getCountryName();
                    String postalCode = addresses.get(i).getPostalCode();
                    String knownName = addresses.get(i).getFeatureName(); // Only if available else return NULL
                    if (knownName.equals("null") || knownName.toString().isEmpty()) {
                        knownName = "Нету информации";
                    }
                    if (address != null) {
                        if (address.toString().isEmpty() || address.equals("null")) {
                            address = "Нету информации";
                        }
                    } else {
                        address = "Нету информации";
                    }
//                    holder = new Holder(knownName, address);
//                    holderArrayList.add(holder);
//                    adapter.notifyDataSetChanged();

                    LayoutInflater inflater = LayoutInflater.from(getApplicationContext());
                    View inflatedLayout = inflater.inflate(R.layout.single_item, null, false);
                    TextView header = (TextView) inflatedLayout.findViewById(R.id.header);
                    TextView street = (TextView) inflatedLayout.findViewById(R.id.second);
                    header.setText(knownName);
                    street.setText(address);
                    layoutToAdd.addView(inflatedLayout);
                }
                progressBar.setVisibility(View.GONE)
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
</code></pre>

<p>I am fully clueless on what is the isssue and what to do with it...It is really annoying me already so if anyone can help me out,i would fully appreciate that.</p>