【发布时间】:2018-08-17 10:28:50
【问题描述】:
以下是我在Fragment 中的布局。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".fragments.TAClaimFragment"
android:background="@drawable/main_gradient"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_anchor="@id/parent"
app:layout_anchorGravity="top">
<android.support.v7.widget.SearchView
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="?actionBarSize"
android:layoutDirection="rtl"
android:id="@+id/ta_search"
android:animateLayoutChanges="true"
app:searchIcon="@drawable/ic_search"
app:closeIcon="@drawable/ic_close"
android:tooltipText="tooltip"
app:searchHintIcon="@drawable/ic_search"
app:queryHint="@string/search_hint"
/>
<ImageView
android:layout_width="0dp"
android:id="@+id/ta_menu"
android:padding="16dp"
android:layout_weight="0.3"
android:layout_height="50dp" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/ta_recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v7.widget.RecyclerView>
</LinearLayout>
RecyclerView 在线性布局中在其上方有一个SearchView 和一个ImageView 我希望线性布局在包含片段的Activity 所具有的工具栏下消失。我对协调器布局或折叠工具栏布局不够熟悉,但我想解决方案在于使用这两者。
我该怎么做?
【问题讨论】: