我已经实现了一个ViewPager Activity(参见下面的布局)。问题是navigationTabBar总是隐藏的。
没有运气,我尝试过修补fitSystemWindows。
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_height="match_parent"
android:id="@+id/tabbed_main"
android:background="#FFFFFF"
android:screenOrientation="portrait"
xmlns:fab="http://schemas.android.com/apk/res-auto">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:isScrollContainer="true"
android:scrollbars="none">
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/vp_horizontal_ntb"
android:gravity="center"
android:paddingLeft="0dp"
android:paddingRight="0dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:fitsSystemWindows="true">
<com.gigamole.navigationtabbar.ntb.NavigationTabBar
android:layout_width="match_parent"
android:layout_height="60dp"
android:id="@+id/ntb_horizontal"
app:ntb_badge_size="12sp"
app:ntb_badge_bg_color="#ffff0000"
app:ntb_badge_gravity="top"
app:ntb_badge_position="right"
app:ntb_badge_title_color="#ffffffff"
app:ntb_badge_use_typeface="true"
app:ntb_badged="true"
app:ntb_animation_duration="400" />
</LinearLayout>
<com.getbase.floatingactionbutton.FloatingActionsMenu
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:id="@+id/create_new_button"
android:layout_marginBottom="60dp"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
fab:fab_addButtonColorNormal="@color/white_add"
fab:fab_addButtonColorPressed="@color/white_pressed"
fab:fab_addButtonPlusIconColor="@color/half_black"
fab:fab_labelStyle="@style/menu_labels_style">
<com.getbase.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/action_create_post"
fab:fab_colorNormal="@color/white_add"
fab:fab_title="Create New Post"
fab:fab_icon="@drawable/ic_create_black_24dp"
fab:fab_colorPressed="@color/white_pressed"/>
<com.getbase.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/action_create_new_message"
fab:fab_colorNormal="@color/white_add"
fab:fab_title="Write New Message"
fab:fab_icon="@drawable/ic_insert_comment_black_24dp"
fab:fab_colorPressed="@color/white_pressed"/>
<com.getbase.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/action_upload_new_album"
fab:fab_colorNormal="@color/white_add"
fab:fab_title="Upload New Album"
fab:fab_icon="@drawable/ic_add_a_photo_black_24dp"
fab:fab_colorPressed="@color/white_pressed"/>
</com.getbase.floatingactionbutton.FloatingActionsMenu>
</android.support.design.widget.CoordinatorLayout>
N.B .- 此主题已经讨论过 link goes here , here ;他们似乎都没有解决我的问题。
答案 0 :(得分:0)
移除RelativeLayout
并将NavigationTabBar
置于与LinearLayout
相同的ViewPager
内。使用ViewPager
将layout_height="0dp"
的高度设置为0,并使用layout_weigth="1"
添加1的权重。布局应如下所示:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
....>
<com.gigamole.navigationtabbar.ntb.NavigationTabBar
android:layout_width="match_parent"
android:layout_height="60dp"
... />
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weigth="1"
... />
</LinearLayout>