删除ActionBar边框 [英] Remove ActionBar Border

查看:87
本文介绍了删除ActionBar边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,这就是问题所在.

So, here is the problem.

此边框显示出来,我想将其删除或至少更改不透明度.由于Lollipop版本的存在,以前有阴影掉落,但是我用actionBar.setElevation(0);

This border is showing up and I would like to remove it or at least change opacity. There was a shadow drop before because of Lollipop version, but I removed that with actionBar.setElevation(0);

这是我班上的动作条码:

Here is actionbar code from my class:

final android.support.v7.app.ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setDisplayUseLogoEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setElevation(0);
    actionBar.setCustomView(R.layout.appbar_layout);

这是我的样式代码:

<resources>

<style name="Theme.Example" parent="@style/Theme.AppCompat.Light">
    <item name="actionBarStyle">@style/ActionBar.Solid.Example</item>
    <item name="android:toolbarStyle">@style/ToolbarStyle</item>
    <item name="toolbarStyle">@style/ToolbarStyle</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:actionModeBackground">@android:color/white</item>
</style>

<style name="ToolbarStyle" parent="@style/Widget.AppCompat.Toolbar">
    <item name="contentInsetStart">0dp</item>
    <item name="android:contentInsetStart">0dp</item>
    <item name="android:windowContentOverlay">@null</item>
</style>

<style name="ActionBar.Solid.Example" parent="@style/Widget.AppCompat.Light.ActionBar.Solid">
    <item name="background">@android:color/white</item>
    <item name="android:titleTextStyle">@style/ActionBarStyle.Transparent.TitleTextStyle</item>
    <item name="android:windowContentOverlay">@null</item>
</style>

<style name="ActionBarStyle.Transparent.TitleTextStyle" parent="@style/Widget.AppCompat.Light.ActionBar">
    <item name="android:background">@drawable/appbar_logo</item>
</style>

推荐答案

在您的应用样式中,设置以下内容:

In your app styles set the following:

 <style name="MyTheme" parent="@style/Theme.AppCompat.Light">
    <item name="colorPrimary">BORDER COLOR HERE</item>
    <item name="colorPrimaryDark">@color/primaryDark</item>
</style>

在您的清单中

<application
    android:label="@string/app_name"
    android:theme="@style/MyTheme">
...
</application>

这篇关于删除ActionBar边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆