2016-10-23 4 views
0

Wie kann ich das folgende Layout in Android erstellen? Ich möchte, dass die untere Leiste eine feste Größe hat und dass die überstehende Leiste basierend auf der Gerätegröße vergrößert wird. Gibt es eine Bibliothek, die für den folgenden Effekt verfügbar ist?Erstellen Sie einen unteren Bereich 3 Bereich auf Android

Bottom bar

Im Moment habe ich ein relativ Layout, aber die Höhe der oberen Platte nicht wächst.

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_alignParentTop="true" 
     android:layout_width="match_parent" 
     android:layout_height="400dp"> 

    </LinearLayout> 

    <LinearLayout 
     android:orientation="horizontal" 
     android:layout_width="match_parent" 
     android:layout_alignParentBottom="true" 
     android:layout_weight="0.71" 
     android:layout_below="@+id/linearLayout" 
     android:layout_height="150dp"></LinearLayout> 
</RelativeLayout> 
+0

https://github.com/Ashok-Varma/BottomNavigation dies überprüfen –

Antwort

0

wie dieses Versuchen

<RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <LinearLayout 
      android:orientation="vertical" 
      android:layout_alignParentTop="true" 
      android:layout_width="match_parent" 
      android:layout_above="@+id/tab_bar" 
      android:layout_height="match_parent"> 

     </LinearLayout> 

     <LinearLayout 
      android:id="@+id/tab_bar" 
      android:orientation="horizontal" 
      android:layout_width="match_parent" 
      android:layout_alignParentBottom="true" 
      android:layout_height="150dp"></LinearLayout> 
    </RelativeLayout> 
0

Sie müssen android setzen: layout_height = "0DP" und android: layout_weight = "1".

Versuchen Sie, diese

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/activity_second" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    tools:context="com.amrizal.example.firebasetester.SecondActivity"> 
    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" 
     android:background="@android:color/darker_gray"> 
     <TextView 
      android:text="Section 1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerInParent="true"/> 
    </RelativeLayout> 
    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="30dp" 
     android:background="@android:color/holo_blue_bright"> 
     <TextView 
      android:text="Section 2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerInParent="true"/> 
    </RelativeLayout> 
</LinearLayout> 
Verwandte Themen