2017-12-08 26 views
-1

TabLayoutを画面の下部に配置しようとしています。 layout_alignParentBottomを使用しようとしましたが、無効なレイアウトパラメータエラーが発生しました。私が使うはずのパラームは?ありがとう。TabLayoutの無効なレイアウトパラメータ(layout_alignParentBottom)

<?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" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    tools:context=".TabBar"> 

    <android.support.design.widget.TabLayout 
     android:id="@+id/tabs" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:tabGravity="fill" 
     app:tabMode="fixed" 
     android:layout_alignParentBottom="true" /> 

    <FrameLayout 
     android:id="@+id/frame_container" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

</LinearLayout> 

答えて

1

スイッチ位置を、あなたは私の答えをtrry layout_weight

<?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" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    tools:context=".TabBar"> 

    <FrameLayout 
     android:id="@+id/frame_container" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" /> 

    <android.support.design.widget.TabLayout 
     android:id="@+id/tabs" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:tabGravity="fill" 
     app:tabMode="fixed" /> 

</LinearLayout> 
0

この

layout_alignParentBottomRelativeLayout.LayoutParams

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

    <android.support.design.widget.TabLayout 
     android:id="@+id/tabs" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:tabGravity="fill" 
     app:tabMode="fixed" 
     android:layout_alignParentBottom="true" /> 

    <FrameLayout 
     android:id="@+id/frame_container" 
     android:layout_width="match_parent" 
     android:layout_above="@+id/tabs" 
     android:layout_height="match_parent" /> 

</RelativeLayout> 
+0

@Pakホーチャンを使用しているしてみてください。 –

関連する問題