日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

android浮于上方布局,android-在FrameLayout中使RecyclerView上方的视图...

發布時間:2023/12/15 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android浮于上方布局,android-在FrameLayout中使RecyclerView上方的视图... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

在單擊按鈕時,我試圖在RecyclerView上方填充EditText.但是,不是將EditText添加到布局的頂部,從而按下了RecyclerView,而是將其簡單地放置在RecyclerView的頂部,如下所示:

您會看到“ New Text”正在覆蓋RecyclerView的第一項.我如何才能使其在RecyclerView上方膨脹,并使RecyclerView向下推,以容納新添加的EditText?

這是我將EditText添加到的FrameLayout的XML:

xmlns:fab="http://schemas.android.com/apk/res-auto"

android:id="@+id/fragment_my_frame_layout"

android:orientation="vertical"

android:layout_width="match_parent"

android:layout_height="match_parent">

android:id="@+id/my_recycler_view"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:scrollbars="vertical" />

android:id="@+id/button_floating_action"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_gravity="bottom|right"

android:layout_margin="16dp"

android:src="@drawable/ic_action_new"

fab:fab_colorNormal="@color/primary_dark"

fab:fab_colorPressed="@color/primary" />

這是我的FloatingActionButton的onClick方法,我希望在其中將EditText添加到RecyclerView上方:

public void onClick(View v) {

ViewGroup parent = (ViewGroup) rootView.findViewById(R.id.fragment_my_frame_layout);

View view = LayoutInflater.from(getActivity()).inflate(R.layout.add_keyword_edittext, parent, true);

}

這是我要添加的EditText的XML:

android:id="@+id/edit_text_above_listview"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:minHeight="?android:attr/listPreferredItemHeight"

android:background="#00000000"

android:textCursorDrawable="@null"

android:imeOptions="actionDone"

android:singleLine="true"

android:text="New Text" />

總結

以上是生活随笔為你收集整理的android浮于上方布局,android-在FrameLayout中使RecyclerView上方的视图...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。