2016-06-14 11 views
0

Ich versuche, eine TextView über die Floating Action Bar hinzuzufügen, aber endete so. Ich werde dieses TextField verwenden, um eine Ganzzahl anzuzeigen.So fügen Sie TextView über die unverankerte Aktionsleiste hinzu

enter image description here

Das ist mein Layout-Datei

<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"> 

    <LinearLayout android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 

     <LinearLayout 
      android:id="@+id/viewA" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_weight="0.5" 
      android:background="#0094d6" 
      android:orientation="horizontal" 
      android:gravity="center_vertical|center_horizontal"> 

     </LinearLayout> 

     <LinearLayout 
      android:id="@+id/viewB" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_weight="0.5" 
      android:orientation="horizontal" 
      android:background="#421575"> 

      <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:padding="@dimen/activity_vertical_margin"> 


       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="100" 
        android:background="#000000" 
        android:padding="10dp" 
        android:textColor="#FFFFFF" 
        android:layout_gravity="bottom" 
        android:layout_alignParentBottom="false" 
        android:layout_alignParentRight="true" 
        android:layout_alignParentEnd="true" /> 
      </RelativeLayout> 

     </LinearLayout> 



     <LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal" 
      android:background="#A12545" 
      android:paddingLeft="5dp" 
      android:paddingRight="5dp" 
      android:paddingBottom="5dp"> 


      <EditText 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:id="@+id/commentBox" 
       android:layout_weight="3" 
       android:hint="" 
       android:maxLength="200" /> 



      <Button 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:id="@+id/sendButton" 
       android:text="" 
       android:layout_weight="1.5" /> 
     </LinearLayout> 

    </LinearLayout> 



    <android.support.design.widget.FloatingActionButton 
     android:id="@+id/like" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_margin="16dp" 
     android:clickable="true" 
     android:src="@drawable/delete" 
     app:layout_anchor="@id/viewA" 
     app:layout_anchorGravity="bottom|right|end" 
     app:backgroundTint="@color/not_liked" /> 



</android.support.design.widget.CoordinatorLayout> 

Wie kann ich das Feld über Floating Action Bar zeigen. Danke

Antwort

0

Sie Ihr Layout wie diese

bestellen können
<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"> 

    <android.support.design.widget.FloatingActionButton 
     ... 
     app:layout_anchorGravity="bottom|right|end" 
     ... 
    /> 

    <LinearLayout android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 

     ... 

    </LinearLayout> 

</android.support.design.widget.CoordinatorLayout> 
+0

nicht funktioniert. Das gleiche Problem noch einmal – Ramesh

Verwandte Themen