Я пытаюсь создать транзакцию Master/Detail в одном фрагменте. Я думал об использовании LinearLayout в качестве контейнера моего edittext для моего заголовка. Затем нажмите RecyclerView для подробностей.Android: сворачивание Linearlayout вместо Collapsing Toolbar
Как реализовать свертывание/расширение LinearLayout, аналогичное эффекту CollapsingToolbar?
Вот скриншот того, что я пытаюсь сделать.
Мой XML-код до сих пор.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/colorAccent"
android:padding="@dimen/activity_horizontal_margin">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_date_range_black_24dp"
android:tint="@android:color/darker_gray" />
<android.support.v4.widget.Space
android:layout_width="@dimen/activity_horizontal_margin"
android:layout_height="wrap_content" />
<android.support.design.widget.TextInputLayout
android:id="@+id/date_til"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Date">
<android.support.design.widget.TextInputEditText
android:id="@+id/date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cursorVisible="false"
android:focusable="false"
android:longClickable="false" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_store_black_24dp"
android:tint="@android:color/darker_gray" />
<android.support.v4.widget.Space
android:layout_width="@dimen/activity_horizontal_margin"
android:layout_height="wrap_content" />
<android.support.design.widget.TextInputLayout
android:id="@+id/store_til"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Store">
<android.support.design.widget.TextInputEditText
android:id="@+id/store"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_place_black_24dp"
android:tint="@android:color/darker_gray" />
<android.support.v4.widget.Space
android:layout_width="@dimen/activity_horizontal_margin"
android:layout_height="wrap_content" />
<android.support.design.widget.TextInputLayout
android:id="@+id/location_til"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/location"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Location" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
app:layoutManager="LinearLayoutManager"
tools:listitem="@layout/list_car" />
</LinearLayout>
Кроме того, не уверен, если это может быть сделано с CollapsingToolbar, так как я в основном видел только ImageView рушится на панели инструментов.
Примите любую помощь.
ОБНОВЛЕНИЕ: В принципе, я хочу сделать это, чтобы иметь возможность свернуть вид заголовка при прокрутке вверх. Затем разверните его при прокрутке вниз.
обновите файл xml здесь –
Добавлен xml-файл. – ank