Android - BottomNavigationMenu and listView in a Linear Layout -
i have strange problem bottomnavigationbar
the situations this: have activity contains - little fragment showing debts , credits , works - listview expenditures , works - bottomnavigationmenubar work partially, indeed not anchored bottom of activity if stay @ bottom of listview untill listview occupy space on display
i attach screen explain better no behaviour, must stay @ bottom
listview bigger screen , works good
here xml
<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/tab_bck" xmlns:design="http://schemas.android.com/apk/res-auto"> <linearlayout android:id="@+id/linearverticallayout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:background="@color/tab_bck" > <android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:id="@+id/expensetoolbar" android:layout_height="?attr/actionbarsize" android:elevation="6dp" app:layout_collapsemode="pin" app:layout_scrollflags="scroll|enteralways" app:popuptheme="@style/apptheme" app:navigationicon="?attr/homeasupindicator" app:titletextcolor="@android:color/white" app:subtitletextcolor="@android:color/white" android:background="@color/colorprimary"> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" /></android.support.v7.widget.toolbar> <framelayout android:id="@+id/fragment" android:layout_width="match_parent" android:layout_height="match_parent" android:name="it.polito.mad17.viral.sliceapp.fragment_of_money" /> <listview android:id="@+id/listview2" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="0dp" android:background="@color/tab_bck" android:longclickable="true" /> <android.support.design.widget.bottomnavigationview android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/bottom_nav_bar" android:layout_gravity="bottom" design:menu="@menu/bottom_nav_bar_menu" design:itemicontint="#16a085" design:itemtextcolor="#16a085"/> </linearlayout> </android.support.design.widget.coordinatorlayout>
put bottombar outside linear layout. this:
<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/tab_bck" xmlns:design="http://schemas.android.com/apk/res-auto"> <linearlayout android:id="@+id/linearverticallayout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:background="@color/tab_bck" > <android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:id="@+id/expensetoolbar" android:layout_height="?attr/actionbarsize" android:elevation="6dp" app:layout_collapsemode="pin" app:layout_scrollflags="scroll|enteralways" app:popuptheme="@style/apptheme" app:navigationicon="?attr/homeasupindicator" app:titletextcolor="@android:color/white" app:subtitletextcolor="@android:color/white" android:background="@color/colorprimary"> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" /></android.support.v7.widget.toolbar> <framelayout android:id="@+id/fragment" android:layout_width="match_parent" android:layout_height="match_parent" android:name="it.polito.mad17.viral.sliceapp.fragment_of_money" /> <listview android:id="@+id/listview2" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="0dp" android:background="@color/tab_bck" android:longclickable="true" /> </linearlayout> <android.support.design.widget.bottomnavigationview android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/bottom_nav_bar" android:layout_gravity="bottom" design:menu="@menu/bottom_nav_bar_menu" design:itemicontint="#16a085" design:itemtextcolor="#16a085"/> </android.support.design.widget.coordinatorlayout>
this should work you
Comments
Post a Comment