我希望ToolBar是透明的。我有一个显示工具栏的活动,如下所示:

我的xml中有以下内容:
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:elevation="0dp"
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="@android:color/transparent" />
</android.support.design.widget.AppBarLayout>但我不能让我的活动在我的ToolBar顶部和背面可见……
我如何才能做到这一点?
发布于 2015-11-25 23:31:08
StackOverflow不允许我发表评论,因为我没有50个名气,这就是为什么我在回答框中评论
你可以在这里找到答案:
发布于 2015-11-25 23:39:29
@RAP的答案似乎是有效的。但请注意,如果您将背景设置为透明,则意味着当用户触摸工具栏并执行一些您不想要的操作时,工具栏仍然可以单击。实现目标的另一种方法是将其可见性设置为INVISIBLE
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setVisibility(View.INVISIBLE);
// to make it appear again:
toolbar.setVisibility(View.VISIBLE);https://stackoverflow.com/questions/33920221
复制相似问题