У меня есть список recyclerview
. Каждый элемент в recyclerview
содержит следующий макет. Позже, когда один щелчок на образце 1, тогда sample3.xml
должен быть вставлен между образцами 1 и sample2. Для этого я создал линейный вывод с идентификатором id в этом макете.android: expand/collapse a recycliewiew item
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="fill_parent"
android:layout_height="40dp"
android:id="@+id/sample1"
android:text="Sample1"/>
<LinearLayout
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/insertat">
</LinearLayout>
<TextView
android:layout_width="fill_parent"
android:layout_height="40dp"
android:id="@+id/sample2"
android:text="Sample2"/>
</LinearLayout>
onclicking
ID sample1 Я хочу, чтобы вставить файл макета sample3.xml
внутри linearlayout
ид InsertAt.
sample3.xml выглядит следующим образом
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/toinsert">
<TextView
android:layout_width="fill_parent"
android:layout_height="40dp"
android:text="Sample1"
android:id="@+id/sample3"/>
</LinearLayout>
Как я могу добиться этого в recyclerview коде.
Я был смущен между невидимыми и ушел. ушел, будет скрываться должным образом. –
android: visibility = "gone" Этот вид невидим, и он не занимает места в макете. android: visibility = "invisible" Этот вид невидим, но он все еще занимает место в макете. – pokuri