Я пытаюсь использовать CoordinatorLayout и CollapsingToolbar и SoftInputMode. Когда я пытался использовать android: fitsSystemWindows = "false" в Layout Coordinator.Это работает хорошо.Но SoftInputMode не работает.Это означает, что когда EditText активен, макет должен изменить размер.Я добавил SOftInputMode в файл манифеста. Но он не работает.
Проблема в том, что android: fitsSystemWindows = "false", фон строки состояния не работает.Но изменение размера макета работает хорошо.
Точно так же, когда android: fitsSystemWindows = "true", фон строки состояния работает хорошо.Но изменение размера макета не работает.
Мой код для макета:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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"
app:statusBarBackground="@color/myCustomColor"
android:theme="@style/AppThemeCorrdinate"
android:fitsSystemWindows="false"
tools:context="com.uiresource.messenger.Conversation">
<android.support.design.widget.AppBarLayout
android:id="@+id/htab_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/my_gradient_bg"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay"
app:expanded="false">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsetoolbar"
android:layout_width="match_parent"
android:layout_height="330dp"
android:fitsSystemWindows="true"
app:contentScrim="@drawable/my_gradient_bg"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
app:titleEnabled="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.app.FragmentTabHost
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0" />
<FrameLayout
android:id="@+id/realTabContent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0" />
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
</android.support.v4.view.ViewPager>
</LinearLayout>
<TabWidget
android:id="@android:id/tabs"
style="@style/MyTabStyle"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="bottom"
android:layout_weight="0"
android:orientation="horizontal"
android:showDividers="none"
android:visibility="gone" />
</android.support.v4.app.FragmentTabHost>
</LinearLayout>
<HorizontalScrollView
android:id="@+id/chipscrollview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:fitsSystemWindows="true"
android:scrollbars="none">
<RadioGroup
android:id="@+id/radiogroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_gravity="bottom"
android:orientation="horizontal"
android:scrollbars="none">
</RadioGroup>
</HorizontalScrollView>
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0"
android:background="@android:color/black"
android:fitsSystemWindows="true"
app:layout_collapseParallaxMultiplier="1.0" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="top"
android:layout_marginBottom="0dp"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="@drawable/user1" />
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:gravity="center"
android:textAllCaps="false"
android:textAppearance="@style/Light"
android:textColor="@android:color/white"
android:textSize="@dimen/h1" />
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/htab_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:visibility="gone"
app:tabIndicatorColor="@android:color/white"
app:tabSelectedTextColor="@android:color/white"
app:tabTextColor="@color/white" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/add_to_cart_fab2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:src="@android:drawable/ic_menu_save"
android:visibility="gone"
app:layout_anchor="@id/toolbar"
app:layout_anchorGravity="bottom|right" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/add_to_cart_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:src="@android:drawable/ic_menu_save"
android:visibility="gone"
app:layout_anchor="@id/htab_appbar"
app:layout_anchorGravity="bottom|center" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/root_layout"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:fillViewport="true"
>
<RelativeLayout
android:id="@+id/rootView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/rl_bottom">
<LinearLayout
android:id="@+id/layout_rvh"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/chaty_bg"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:clipToPadding="false"
android:overScrollMode="never"
android:paddingTop="8dp"
android:paddingBottom="20dp" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:fitsSystemWindows="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">
<HorizontalScrollView
android:id="@+id/hsv_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="@color/white"
android:gravity="bottom"
android:scrollbars="none"
android:visibility="visible">
<LinearLayout
android:id="@+id/chat_quick_area"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<include
layout="@layout/rich_replies_card"
android:visibility="visible" />
</LinearLayout>
</HorizontalScrollView>
<RelativeLayout
android:id="@+id/editContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/hsv_content"
android:background="#E9EDED"
android:paddingLeft="@dimen/space10"
android:paddingTop="@dimen/space5"
android:paddingRight="@dimen/space5"
android:paddingBottom="@dimen/space5">
<ImageButton
android:id="@+id/bt_send"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:background="@drawable/bg_btnsend_rounded"
android:gravity="center"
android:padding="@dimen/space5"
android:src="@drawable/baseline_send_white_36"
android:stateListAnimator="@null"
android:textAppearance="@style/Light"
android:textColor="@color/white"
android:textSize="@dimen/h3" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/space5"
android:layout_toLeftOf="@id/bt_send"
android:background="@drawable/bg_white_rounded">
<ImageButton
android:id="@+id/bt_attachment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:background="@android:color/transparent"
android:padding="@dimen/space10"
app:srcCompat="@drawable/ic_attachment" />
<EditText
android:id="@+id/et_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/bt_attachment"
android:background="@android:color/transparent"
android:hint="Enter your message"
android:inputType="textCapSentences"
android:maxLines="3"
android:padding="@dimen/space10"
android:textAppearance="@style/ThemeOverlay.AppCompat.Dark"
android:textColor="@color/colorTextBlack"
android:textColorHint="@color/colorTextHint"
android:textSize="@dimen/h2" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="gone"
android:gravity="bottom">
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>