2016-06-14 18 views
0

浮動アクションバー上にTextViewを追加しようとしていますが、このようになりました。そのtextFieldを使って整数を表示します。浮動アクションバー上にTextViewを追加する方法

enter image description here

これは私が浮動アクションバー上のフィールドを表示することができますどのように私のレイアウトファイル

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

です。 はあなたが

答えて

0

あなたはこの

<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

が機能していないようなあなたのレイアウトを注文することができますありがとうございます。再び同じ問題 – Ramesh

関連する問題