1
我想創建一個配置文件的活動,其工具欄應該是在某種程度上是這樣的: 衰落android.support.v7.widget.Toolbar
而且我不瞭解如何擺脫這種陰影或疊加效應,也許這已經解決了我的問題。
activity_activity_profil.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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.appmac.ron.app_newsfeed.ActivityProfil">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/toolbar_color"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_activity_profil" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_dialog_email" />
</android.support.design.widget.CoordinatorLayout>
toolbar_color.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="90"
android:centerColor="#7b7b7b"
android:endColor="#2b2b2b"
android:startColor="#ffffff"
android:type="linear" />
</shape>
UPDATE: 陰影消失了,現在我想使我的工具欄透明,像這樣:
我有現在這一權利:
如果需要更多的代碼只是告訴我,我會更新。 感謝您的幫助!
非常感謝,幫助!我更新了我的帖子,你也有一些建議嗎? @Eugen Pechanec – Ron
正如我所說的將工具欄的背景移到AppBarLayout。它應該是從#4000到#0000的漸變。將內容視圖(滾動視圖)放在CoordinatorLayout後面並將paddingTop設置爲'?actionBarSize'。你最好發表另一個問題。 –
我得到了這種有助於淡化的顏色效果,但我想讓它變得透明,以便您可以看到工具欄後面的內容滾動:/ @Eugen Pechanec – Ron