如何删除android操作栏中的下边框?

时间:2018-04-04 06:50:45

标签: android android-actionbar

我在论坛中找到了如何删除Android操作栏中的边框底部,但没有方法(setElevation(0) and <item name="android:windowContentOverlay">@null</item>)可以使用我的示例。

始终有边框。

enter image description here

感谢。

解决:

我做到了!!对不起,我很困惑,因为我认为边框/阴影是ActionBar主题,但不是,它是活动主题。我用“@null”添加了活动风格,感谢大家的帮助。

2 个答案:

答案 0 :(得分:0)

<!-- Theme without ActionBar shadow (inherits main theme) -->
    <style name="MyNoActionBarShadowTheme" parent="MyAppTheme">
        <item name="windowContentOverlay">@null</item>
        <item name="android:windowContentOverlay">@null</item>
    </style>

在styles.xml文件中使用此样式

答案 1 :(得分:0)

您可以通过以下代码移除ActionBar上的高程/阴影:

按xml:

 <android.support.design.widget.AppBarLayout
            android:id="@+id/appBarLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:elevation="0dp">
            ...
</android.support.design.widget.AppBarLayout>

通过Java:

要使用java代码删除高程,请仅使用以下一行... getSupportActionBar().setElevation(0);

,或者

 getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
 getSupportActionBar().setElevation(0);
相关问题