MainActivity
のタブレイアウトはViewPager
ですが、MainActivity
にボトムナビゲーションを追加していますが、ViewPager
が下部ナビゲーションの上部に表示されるようにします。ここでデバイスの画面の高さに関係なくViewPagerの高さを設定する方法は?
が私の主な活動のレイアウトが
<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"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<TextView
android:id="@+id/logo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="10sp"
android:paddingTop="10sp"
android:textAlignment="center"
android:layout_gravity="center"
android:gravity="center"
android:textColor="@color/white"
android:textStyle="bold"
android:textSize="40sp"
android:text="@string/app_name" />
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed"
app:tabGravity="fill"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_gravity="top"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<include layout="@layout/bottom_nav"></include>
</android.support.design.widget.CoordinatorLayout>
ある現在ViewPager
は、下部のナビゲーションバーの背後にある完全な高さにまたがります。私は私のViewpager
親のレイアウトなど
これは問題を解決しますが、なぜ私が最初にCoordinatorLayoutを使用していたのか分かりませんが、感謝します。 –
@vikasdevdeもしあなたがそれを助けてくれたら、私の投稿を受け入れて他の人にとって役に立ちますようにしてください。 – Kuls