これはどのように見えるかの例です。透明AppBarLayoutとCollapsingToolbarLayout
私はCollapsingToolbarLayoutとAppBarLayout実装にCheesesquareからこの偉大な例を以下ました。 CollapsingToolbarLayout(レイアウトxmlでコメントアウトされています)内のマップでコンテンツを操作することができましたが、これは望ましい結果ではありません。
しかし、灰色のボックス(中央の画像を参照)を最初の位置に透明にするための解決策やドキュメントは見つかりませんでした。地図を見通すために透明にしたいと思います。ユーザーがスクロールすると、CollapsingToolbarLaoyutはその作業を行い、透過ウィンドウを折りたたんでツールバーを表示する必要があります。今のところ、画像はただ白く見えます。私はすでに透明に色を設定しようとしましたが、望みの効果がありませんでした。
だから私の質問:はどのように設定することができ、「CollapsingToolbarLayout」透明初期段階で(画像レイヤ1灰色のボックスを参照してください)?
ここにレイアウトのコードを示します。 CollapsingToolbarLayoutは素晴らしいですが、私は下の地図を見ることができません。実現することができれば素晴らしいだろう。私は 初期段階で "CollapsingToolbarLayoutが" 透明設定することができます(画像レイヤ1つの灰色のボックスを参照)をどのように
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<!-- Layer 0 -->
<FrameLayout
android:id="@+id/overlayFragmentMap"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="0dip"
/>
<!-- Layer 1 -->
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="192dp"
android:fitsSystemWindows="true"
android:theme="@style/CustomActionBar">
<!--android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar-->
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorAccent"
app:expandedTitleMarginBottom="32dp"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:expandedTitleTextAppearance="@color/black"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<!-- Map view inside here works perfectly but is not
the deisired result -->
<!--
<FrameLayout
android:id="@+id/overlayFragmentMap"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="0dip"
app:layout_collapseMode="parallax"
/>
-->
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/transparent"
android:elevation="4dip"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<!-- Fragment with recyclerview inside -->
<FrameLayout
android:id="@+id/overlayFragmentContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="3dip"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dip"
android:clickable="true"
app:layout_anchor="@+id/appbar"
app:layout_anchorGravity="bottom|right|end" />
</android.support.design.widget.CoordinatorLayout>
透明なウィンドウの内容は何ですか?それとも単なる透明な窓ですか? – Mohsen
透明なビューにする必要があります。基本レイヤーのマップを見ていきたいと思います。 – Devdroid