當我嘗試將背景設置爲透明時,我的工具欄始終保持灰色。 這是我的XML。無法在Android中使工具欄透明
<android.support.v7.widget.Toolbar 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="wrap_content"
android:background="@android:color/transparent"
android:minHeight="@dimen/abc_action_bar_default_height_material"
app:theme="@style/Rushmore.Toolbar.Transparent" />
我的主題
<style name="Rushmore.Toolbar.Transparent" parent="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:windowActionBarOverlay">true</item>
<!-- Support Library compability -->
<item name="windowActionBarOverlay">true</item>
</style>
我從代碼
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_actionbar);
toolbar.setBackgroundResource(Color.TRANSPARENT);
嘗試了我不知道它是什麼,我缺少的...
http://developer.android.com/training/basics/actionbar/overlaying.html看看這個鏈接。這給出瞭如何覆蓋工具欄 – arjun
@arjun是否爲操作欄?我已經設置了- true
如上所述 –
嘗試更改自定義樣式的父級,並將樣式設置爲活動而不是工具欄。疊加應該在活動層面完成。 – arjun