2

我的應用程序的一部分是顯示訂單詳細信息的活動,它具有主要的NestedScrollViewlayout,並且位於AppBarLayout下。問題是NestedScrollViewlayout在第一次運行時會在AppBarLayout下運行因此,我也向NestedScrollViewlayout添加了應用程序:layout_behavior =「@string/appbar_scrolling_view_behavior」,但是我沒有得到任何好運。內容在第一次運行時處於標題下

這是我的XML代碼:

<?xml version="1.0" encoding="utf-8"?> 


<android.support.design.widget.CoordinatorLayout 

    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/main_content" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true"> 

    <android.support.design.widget.AppBarLayout 
     android:id="@+id/appbarLayout" 
     android:layout_width="match_parent" 
     android:layout_height="256dp" 
     android:fitsSystemWindows="true" 

     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

     <android.support.design.widget.CollapsingToolbarLayout 
      android:id="@+id/collapsingToolbar" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:fitsSystemWindows="true" 
      app:collapsedTitleGravity="right|center" 
      app:contentScrim="?attr/colorPrimary" 
      app:expandedTitleGravity="right|bottom" 
      app:layout_scrollFlags="scroll|exitUntilCollapsed" 


      > 

      <ImageView 
       android:id="@+id/productImage_Single_Suggest" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:fitsSystemWindows="true" 
       android:scaleType="centerCrop" 
       android:src="@drawable/loginbg_opt" 
       app:layout_collapseMode="pin" /> 

      <android.support.v7.widget.Toolbar 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       android:elevation="7dp" 
       app:layout_collapseMode="pin" 
       app:popupTheme="@style/ThemeOverlay.AppCompat.Light"> 

      </android.support.v7.widget.Toolbar> 
     </android.support.design.widget.CollapsingToolbarLayout> 
    </android.support.design.widget.AppBarLayout> 


    <android.support.design.widget.FloatingActionButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_margin="15dp" 
     android:src="@drawable/user" 
     app:layout_anchor="@id/appbarLayout" 
     app:layout_anchorGravity="bottom|right" 

     /> 

    <android.support.v4.widget.NestedScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

     <RelativeLayout 

      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="10dp" 
      android:layout_marginRight="10dp" 

      android:layout_marginTop="50dp"> 

      <LinearLayout 
       android:id="@+id/product_name_suggest_single" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:background="@drawable/items" 
       android:gravity="right" 
       android:orientation="horizontal" 
       android:padding="15dp"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:gravity="right" 
        android:text="باقله تبریزی اعلا " 
        android:textAlignment="gravity" 
        android:textSize="18sp" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="10dp" 
        android:gravity="right" 
        android:text="نام محصول:" 
        android:textAlignment="gravity" 
        android:textSize="20sp" /> 


      </LinearLayout> 

      <LinearLayout 
       android:id="@+id/product_code_suggest_single" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/product_name_suggest_single" 
       android:layout_marginTop="10dp" 
       android:background="@drawable/items" 
       android:gravity="right" 
       android:orientation="horizontal" 
       android:padding="15dp"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:gravity="right" 
        android:text="2122" 
        android:textAlignment="gravity" 
        android:textSize="18sp" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="10dp" 
        android:gravity="right" 
        android:text="کد محصول" 
        android:textAlignment="gravity" 
        android:textSize="20sp" /> 
      </LinearLayout> 

      <LinearLayout 
       android:id="@+id/product_count_suggest_single" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/product_code_suggest_single" 
       android:layout_marginTop="10dp" 
       android:background="@drawable/items" 
       android:gravity="right" 
       android:orientation="horizontal" 
       android:padding="15dp"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:gravity="right" 
        android:text="1111" 
        android:textAlignment="gravity" 
        android:textSize="18sp" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="10dp" 
        android:gravity="right" 
        android:text="موجودی انبار:" 
        android:textAlignment="gravity" 
        android:textSize="20sp" /> 
      </LinearLayout> 

      <LinearLayout 
       android:id="@+id/txtSuggestion" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/product_count_suggest_single" 
       android:layout_marginTop="10dp" 
       android:background="@drawable/items" 
       android:gravity="right" 
       android:orientation="vertical" 
       android:padding="15dp"> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="10dp" 
        android:gravity="right" 
        android:text="پیشنهاد" 
        android:textAlignment="gravity" 
        android:textSize="20sp" /> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:background="@drawable/roundcorner" 
        android:padding="10dp" 
        android:text=" ژنرال ارتش ترکیه روز چهارشنبه ۳۰ تیرماه رسما به تلاش برای انجام کودتا در این کشور متهم شدند. همزمان، ۲۶۲ قاضی و دادستان دادگاه‌های نظامی و ۹۰۰ پلیس در آنکارا پایتخت ترکیه نیز از سمت خود تعلیق شده‌اند. 

شش هزار و ۵۰۰ نفر دیگر از کارکنان وزارت آموزش ملی این کشور نیز از سمت‌های خود تعلیق شده‌اند. این اقدام یک روز پس از اخراج بیش از ۱۵ هزار معلم از سوی این وزارتخانه صورت می‌گیرد. 

دولت ترکیه روز سه‌شنبه همچنین مجوز تدریس ۲۱ هزار معلم شاغل در بخش خصوصی را لغو کرده بود. 

با احتساب این ارقام، تاکنون بیش از ۶۰ هزار قاضی، معلم، سرباز، پلیس و کارمند دولت از کار خود تعلیق شده‌اند." /> 
      </LinearLayout> 

      <LinearLayout 
       android:id="@+id/txtreplayToSuggestion" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/txtSuggestion" 
       android:layout_marginTop="10dp" 
       android:background="@drawable/items" 
       android:gravity="right" 
       android:orientation="vertical" 
       android:padding="15dp"> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="10dp" 
        android:gravity="right" 
        android:text="پاسخ به پیشنهاد" 
        android:textAlignment="gravity" 
        android:textSize="20sp" /> 

       <EditText 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:background="@drawable/roundcorner" 
        android:padding="10dp" 
        android:text=" ژنرال ارتش ترکیه روز چهارشنبه ۳۰ تیرماه رسما به تلاش برای انجام کودتا در این کشور متهم شدند. همزمان، ۲۶۲ قاضی و دادستان دادگاه‌های نظامی و ۹۰۰ پلیس در آنکارا پایتخت ترکیه نیز از سمت خود تعلیق شده‌اند. 

شش هزار و ۵۰۰ نفر دیگر از کارکنان وزارت آموزش ملی این کشور نیز از سمت‌های خود تعلیق شده‌اند. این اقدام یک روز پس از اخراج بیش از ۱۵ هزار معلم از سوی این وزارتخانه صورت می‌گیرد. 

دولت ترکیه روز سه‌شنبه همچنین مجوز تدریس ۲۱ هزار معلم شاغل در بخش خصوصی را لغو کرده بود. 

با احتساب این ارقام، تاکنون بیش از ۶۰ هزار قاضی، معلم، سرباز، پلیس و کارمند دولت از کار خود تعلیق شده‌اند." /> 
      </LinearLayout> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/txtreplayToSuggestion" 
       android:text="ارسال ایمیل" /> 
     </RelativeLayout> 
    </android.support.v4.widget.NestedScrollView> 
</android.support.design.widget.CoordinatorLayout> 

,並在第一次運行我的應用程序圖:

enter image description here

+0

試着用你的'FloatingActionButton'切換你的'NestedScrollView'。這會讓你的'FloatingActionButton'出現在你的滾動內容之上,並且它*可以*修正出現在ActionBarLayout下面的滾動內容。 – Bryan

回答

0

嗨給這個代碼試一試,看看它是否適合你,我已刪除從您發佈的代碼的背景,因爲我沒有這個drawables,你可以,如果加上它我代碼工作

MyActivity.xml

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout 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:fitsSystemWindows="true" 
    tools:context="com.example.myapplication.MyActivity"> 

    <android.support.design.widget.AppBarLayout 
     android:id="@+id/app_bar" 
     android:layout_width="match_parent" 
     android:layout_height="@dimen/app_bar_height" 
     android:fitsSystemWindows="true" 
     android:theme="@style/AppTheme.AppBarOverlay"> 

     <android.support.design.widget.CollapsingToolbarLayout 
      android:id="@+id/toolbar_layout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:fitsSystemWindows="true" 
      app:contentScrim="?attr/colorPrimary" 
      app:layout_scrollFlags="scroll|exitUntilCollapsed"> 

      <ImageView 
       android:id="@+id/productImage_Single_Suggest" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:fitsSystemWindows="true" 
       android:scaleType="centerCrop" 
       android:src="@drawable/loginbg_opt" 
       app:layout_collapseMode="parallax" /> 

      <android.support.v7.widget.Toolbar 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       app:layout_collapseMode="pin" 
       app:popupTheme="@style/AppTheme.PopupOverlay" /> 

     </android.support.design.widget.CollapsingToolbarLayout> 
    </android.support.design.widget.AppBarLayout> 

    <include layout="@layout/content_of_my_activity" /> 

    <android.support.design.widget.FloatingActionButton 
     android:id="@+id/fab" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_margin="@dimen/fab_margin" 
     android:src="@android:drawable/ic_dialog_email" 
     app:layout_anchor="@id/app_bar" 
     app:layout_anchorGravity="bottom|end" /> 

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

content_of_my_activity.xml

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.NestedScrollView 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" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context="com.example.myapplication.MyActivity" 
    tools:showIn="@layout/activity_scrolling"> 


     <RelativeLayout 

      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="10dp" 
      android:layout_marginRight="10dp" 

      android:layout_marginTop="50dp"> 

      <LinearLayout 
       android:id="@+id/product_name_suggest_single" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:gravity="right" 
       android:orientation="horizontal" 
       android:padding="15dp"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:gravity="right" 
        android:text="باقله تبریزی اعلا " 
        android:textAlignment="gravity" 
        android:textSize="18sp" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="10dp" 
        android:gravity="right" 
        android:text="نام محصول:" 
        android:textAlignment="gravity" 
        android:textSize="20sp" /> 


      </LinearLayout> 

      <LinearLayout 
       android:id="@+id/product_code_suggest_single" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/product_name_suggest_single" 
       android:layout_marginTop="10dp" 
       android:gravity="right" 
       android:orientation="horizontal" 
       android:padding="15dp"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:gravity="right" 
        android:text="2122" 
        android:textAlignment="gravity" 
        android:textSize="18sp" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="10dp" 
        android:gravity="right" 
        android:text="کد محصول" 
        android:textAlignment="gravity" 
        android:textSize="20sp" /> 
      </LinearLayout> 

      <LinearLayout 
       android:id="@+id/product_count_suggest_single" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/product_code_suggest_single" 
       android:layout_marginTop="10dp" 
       android:gravity="right" 
       android:orientation="horizontal" 
       android:padding="15dp"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:gravity="right" 
        android:text="1111" 
        android:textAlignment="gravity" 
        android:textSize="18sp" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="10dp" 
        android:gravity="right" 
        android:text="موجودی انبار:" 
        android:textAlignment="gravity" 
        android:textSize="20sp" /> 
      </LinearLayout> 

      <LinearLayout 
       android:id="@+id/txtSuggestion" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/product_count_suggest_single" 
       android:layout_marginTop="10dp" 
       android:gravity="right" 
       android:orientation="vertical" 
       android:padding="15dp"> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="10dp" 
        android:gravity="right" 
        android:text="پیشنهاد" 
        android:textAlignment="gravity" 
        android:textSize="20sp" /> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:padding="10dp" 
        android:text=" ژنرال ارتش ترکیه روز چهارشنبه ۳۰ تیرماه رسما به تلاش برای انجام کودتا در این کشور متهم شدند. همزمان، ۲۶۲ قاضی و دادستان دادگاه‌های نظامی و ۹۰۰ پلیس در آنکارا پایتخت ترکیه نیز از سمت خود تعلیق شده‌اند. 

شش هزار و ۵۰۰ نفر دیگر از کارکنان وزارت آموزش ملی این کشور نیز از سمت‌های خود تعلیق شده‌اند. این اقدام یک روز پس از اخراج بیش از ۱۵ هزار معلم از سوی این وزارتخانه صورت می‌گیرد. 

دولت ترکیه روز سه‌شنبه همچنین مجوز تدریس ۲۱ هزار معلم شاغل در بخش خصوصی را لغو کرده بود. 

با احتساب این ارقام، تاکنون بیش از ۶۰ هزار قاضی، معلم، سرباز، پلیس و کارمند دولت از کار خود تعلیق شده‌اند." /> 
      </LinearLayout> 

      <LinearLayout 
       android:id="@+id/txtreplayToSuggestion" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/txtSuggestion" 
       android:layout_marginTop="10dp" 
       android:gravity="right" 
       android:orientation="vertical" 
       android:padding="15dp"> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="10dp" 
        android:gravity="right" 
        android:text="پاسخ به پیشنهاد" 
        android:textAlignment="gravity" 
        android:textSize="20sp" /> 

       <EditText 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:padding="10dp" 
        android:text=" ژنرال ارتش ترکیه روز چهارشنبه ۳۰ تیرماه رسما به تلاش برای انجام کودتا در این کشور متهم شدند. همزمان، ۲۶۲ قاضی و دادستان دادگاه‌های نظامی و ۹۰۰ پلیس در آنکارا پایتخت ترکیه نیز از سمت خود تعلیق شده‌اند. 

شش هزار و ۵۰۰ نفر دیگر از کارکنان وزارت آموزش ملی این کشور نیز از سمت‌های خود تعلیق شده‌اند. این اقدام یک روز پس از اخراج بیش از ۱۵ هزار معلم از سوی این وزارتخانه صورت می‌گیرد. 

دولت ترکیه روز سه‌شنبه همچنین مجوز تدریس ۲۱ هزار معلم شاغل در بخش خصوصی را لغو کرده بود. 

با احتساب این ارقام، تاکنون بیش از ۶۰ هزار قاضی، معلم، سرباز، پلیس و کارمند دولت از کار خود تعلیق شده‌اند." /> 
      </LinearLayout> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/txtreplayToSuggestion" 
       android:text="ارسال ایمیل" /> 
     </RelativeLayout> 
</android.support.v4.widget.NestedScrollView> 
0

你需要換FloatingActionButton和NestedScrollView。所以,你都會有這樣的XML:

<?xml version="1.0" encoding="utf-8"?> 


<android.support.design.widget.CoordinatorLayout 

xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:id="@+id/main_content" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true"> 

<android.support.design.widget.AppBarLayout 
    android:id="@+id/appbarLayout" 
    android:layout_width="match_parent" 
    android:layout_height="256dp" 
    android:fitsSystemWindows="true" 

    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

    <android.support.design.widget.CollapsingToolbarLayout 
     android:id="@+id/collapsingToolbar" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:fitsSystemWindows="true" 
     app:collapsedTitleGravity="right|center" 
     app:contentScrim="?attr/colorPrimary" 
     app:expandedTitleGravity="right|bottom" 
     app:layout_scrollFlags="scroll|exitUntilCollapsed" 


     > 

     <ImageView 
      android:id="@+id/productImage_Single_Suggest" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:fitsSystemWindows="true" 
      android:scaleType="centerCrop" 
      android:src="@drawable/loginbg_opt" 
      app:layout_collapseMode="pin" /> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:elevation="7dp" 
      app:layout_collapseMode="pin" 
      app:popupTheme="@style/ThemeOverlay.AppCompat.Light"> 

     </android.support.v7.widget.Toolbar> 
    </android.support.design.widget.CollapsingToolbarLayout> 
</android.support.design.widget.AppBarLayout> 

<android.support.v4.widget.NestedScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

    <RelativeLayout 

     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="10dp" 
     android:layout_marginRight="10dp" 

     android:layout_marginTop="50dp"> 

     <LinearLayout 
      android:id="@+id/product_name_suggest_single" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="@drawable/items" 
      android:gravity="right" 
      android:orientation="horizontal" 
      android:padding="15dp"> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:gravity="right" 
       android:text="باقله تبریزی اعلا " 
       android:textAlignment="gravity" 
       android:textSize="18sp" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="10dp" 
       android:gravity="right" 
       android:text="نام محصول:" 
       android:textAlignment="gravity" 
       android:textSize="20sp" /> 


     </LinearLayout> 

     <LinearLayout 
      android:id="@+id/product_code_suggest_single" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/product_name_suggest_single" 
      android:layout_marginTop="10dp" 
      android:background="@drawable/items" 
      android:gravity="right" 
      android:orientation="horizontal" 
      android:padding="15dp"> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:gravity="right" 
       android:text="2122" 
       android:textAlignment="gravity" 
       android:textSize="18sp" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="10dp" 
       android:gravity="right" 
       android:text="کد محصول" 
       android:textAlignment="gravity" 
       android:textSize="20sp" /> 
     </LinearLayout> 

     <LinearLayout 
      android:id="@+id/product_count_suggest_single" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/product_code_suggest_single" 
      android:layout_marginTop="10dp" 
      android:background="@drawable/items" 
      android:gravity="right" 
      android:orientation="horizontal" 
      android:padding="15dp"> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:gravity="right" 
       android:text="1111" 
       android:textAlignment="gravity" 
       android:textSize="18sp" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="10dp" 
       android:gravity="right" 
       android:text="موجودی انبار:" 
       android:textAlignment="gravity" 
       android:textSize="20sp" /> 
     </LinearLayout> 

     <LinearLayout 
      android:id="@+id/txtSuggestion" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/product_count_suggest_single" 
      android:layout_marginTop="10dp" 
      android:background="@drawable/items" 
      android:gravity="right" 
      android:orientation="vertical" 
      android:padding="15dp"> 

      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="10dp" 
       android:gravity="right" 
       android:text="پیشنهاد" 
       android:textAlignment="gravity" 
       android:textSize="20sp" /> 

      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:background="@drawable/roundcorner" 
       android:padding="10dp" 
       android:text="some text" /> 
     </LinearLayout> 

     <LinearLayout 
      android:id="@+id/txtreplayToSuggestion" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/txtSuggestion" 
      android:layout_marginTop="10dp" 
      android:background="@drawable/items" 
      android:gravity="right" 
      android:orientation="vertical" 
      android:padding="15dp"> 

      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="10dp" 
       android:gravity="right" 
       android:text="پاسخ به پیشنهاد" 
       android:textAlignment="gravity" 
       android:textSize="20sp" /> 

      <EditText 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:background="@drawable/roundcorner" 
       android:padding="10dp" 
       android:text=" some text" /> 
     </LinearLayout> 

     <Button 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/txtreplayToSuggestion" 
      android:text="ارسال ایمیل" /> 
    </RelativeLayout> 
</android.support.v4.widget.NestedScrollView> 

<android.support.design.widget.FloatingActionButton 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_margin="15dp" 
    android:src="@drawable/user" 
    app:layout_anchor="@id/appbarLayout" 
    app:layout_anchorGravity="bottom|right"/> 

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

謝謝你的重播,但這不是我的答案。我複製並粘貼到我的XML佈局,看到它似乎工作,但我不能填充我的文字與內容,當我填充文本的內容。我得到了和我在問題中所說的一樣的東西。 – AndroidDev

+0

對不起,我沒有理解,你是什麼意思的「不是我的答案」?關於代碼,如果您經歷教程,大多數情況下將FloatingActionButton放置在xml的末尾。這裏是一個例子http://saulmm.github.io/mastering-coordinator –

+0

是的,你是對的,但問題不floatingActionButton,我也刪除floatingActionButton,但我得到相同的 – AndroidDev

相關問題