armcha / LuseenBottomNavigation

BottomNavigationView Designed according Google guideLine
1.01k stars 180 forks source link

Bug and Problem in Use this Library. #30

Open QuestionPython opened 7 years ago

QuestionPython commented 7 years ago

Hello, tank you. i import your lib. and gradle is ready.

but in my layout have problem

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="58dp"
        android:background="@android:color/holo_green_dark"
        android:minHeight="?attr/actionBarSize"
        android:titleTextColor="#ffffff">

    </android.support.v7.widget.Toolbar>

    <Button
        android:id="@+id/btnPayment"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Payment"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"/>

    <com.luseen.luseenbottomnavigation.BottomNavigation.BottomNavigationView
        android:id="@+id/bottomNavigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true" />

</LinearLayout>

Error show in Android Studio :

java.lang.IndexOutOfBoundsException: Position must be less or equivalent than items size, items size is -1 current is 0   at com.luseen.luseenbottomnavigation.BottomNavigation.BottomNavigationView.onSizeChanged(BottomNavigationView.java:156)   at android.view.View.sizeChange(View.java:17641)   at android.view.View.setFrame(View.java:17603)   at android.view.View.layout(View.java:17520)   at android.view.ViewGroup.layout(ViewGroup.java:5612)   at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741)   at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1730)   at android.widget.LinearLayout.onLayout(LinearLayout.java:1496)   at android.view.View.layout(View.java:17523)   at android.view.ViewGroup.layout(ViewGroup.java:5612)   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)   at android.widget.FrameLayout.onLayout(FrameLayout.java:261)   at android.view.View.layout(View.java:17523)   at android.view.ViewGroup.layout(ViewGroup.java:5612)   at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)   at android.view.View.layout(View.java:17523)   at android.view.ViewGroup.layout(ViewGroup.java:5612) Copy stack to clipboard   Tip: Try to refresh the layout.