透明的ActionBar和的状态栏。在Android的棒棒糖棒棒糖、状态栏、透明、ActionBar

由网友(你只有我才配拥有ヾ)分享简介:我想创建这个接口:这里是我的实际结果是:And here is my actual result :在状态栏非常透明,我们看到我的形象作为背景:确定在操作栏不是透明的:NOK 下面是我的主题,我使用这项活动的code:Here is the code of my theme that i use for this...

我想创建这个接口:

这里是我的实际结果是:

And here is my actual result :

在状态栏非常透明,我们看到我的形象作为背景:确定 在操作栏不是透明的:NOK

下面是我的主题,我使用这项活动的code:

Here is the code of my theme that i use for this activity :

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- inherit from the material theme -->
    <style name="MaterialAppDetailTheme" parent="android:Theme.Material.Light">


        <item name="android:statusBarColor">@android:color/transparent</item>
        <item name="android:windowActionBarOverlay">true</item>

        <!-- enable window content transitions -->
        <item name="android:windowContentTransitions">true</item>

        <!-- specify shared element transitions -->
        <item name="android:windowSharedElementEnterTransition">
            @transition/change_image_transform</item>
        <item name="android:windowSharedElementExitTransition">
            @transition/change_image_transform</item>

    <item name="android:windowTranslucentNavigation">true</item>
    <item name="android:windowTranslucentStatus">true</item>

</style>

推荐答案

您可以更改工具栏的颜色为透明这样的:

You can change your toolbar color to transparent like this:

mToolbar.setBackgroundColor(getResources().getColor(android.R.color.transparent));

您可以改变它的背景上的XML太:

You can change it's background on the XML too:

android:background="@android:color/transparent"

或者,如果您使用的是动作条:

Or if you're using ActionBar:

getSupportActionBar().setBackgroundDrawable(new ColorDrawable(getResources().getColor(android.R.color.transparent)));

使用 getActionBar()如果你不使用 ActionBarActivity

结果:

阅读全文

相关推荐

最新文章