Раздувая вид выше RecyclerView в FrameLayout
При нажатии кнопки я пытаюсь надутьEditText
вышеRecyclerView
, Но вместо того, чтобы EditText был добавлен в верхнюю часть макета, таким образом отталкивая RecyclerView, он просто помещается поверх RecyclerView, покрывая его следующим образом:
Вы можете видеть, что «Новый текст» охватывает первый элемент RecyclerView. Как я могу заставить его надуться над RecyclerView, и заставить RecyclerView надавить, приспосабливая недавно добавленный EditText?
Вот XML моего FrameLayout, к которому я добавляю EditText:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
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.support.v7.widget.RecyclerView
android:id="@+id/my_recycler_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="vertical" />
<com.melnykov.fab.FloatingActionButton
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" />
Вот метод onClick моего FloatingActionButton, где я хочу добавить 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);
}
Вот XML-код EditText, который я добавляю:
<?xml version="1.0" encoding="utf-8"?>
<EditText xmlns:android="http://schemas.android.com/apk/res/android"
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" />