2017-12-08 6 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 호청을 사용하는 것입니다보십시오 . –