我有一个应用程序,该应用程序具有FragmentA中的图像的回收视图,当用户单击图像时,我希望图像在FragmentA顶部的FragmentB中展开,并在背景中显示FragmentA,如下所示:
如何获得这种有色的半透明背景?另外,单击黄色圆圈区域时,从屏幕底部显示的工具栏是否有名称?
这是我目前拥有的:
fragment_A.xml:
<?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"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_main"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:layout_scrollFlags="scroll|enterAlways" />
</android.support.design.widget.AppBarLayout>
<!-- main recycler content-->
<include layout="@layout/recycler_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout>
fragment_B.xml:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/colorPrimaryDark"
android:clickable="true">
<!-- Place where image will be displayed-->
<com.github.chrisbanes.photoview.PhotoView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/view_media_viewer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
</FrameLayout>