Android app masthead display

只谈情不闲聊 提交于 2019-12-13 09:35:22

问题


I have created an app using Android Studio 2.3.3, choosing Empty Activity Template. After its creation I went and changed the background color to something like colorAccent and I also changed the colorPrimary to colorAccent in colors.xml.

Now, when I ran the app, following emulator display appeared.

As you can see, it displays my app name, followed by a dark line. I don't understand where this dark line has come from and how can I get rid of this?

However, this dark line does not appear in Android Studio design mode (see screenshot below).


回答1:


it is shadow of action bar my friend to remove this shadow add below lines to your theme under res/values/style

<style name="MYTheme" parent="android:Theme.Holo.Light">
    <item name="colorPrimary">@color/colorWhite</item>
    <item name="colorPrimaryDark">@color/colorWhite</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="windowContentOverlay">@null</item>
    <item name="android:windowContentOverlay">@null</item>
</style>

now add this in manifest file this to your activity

<activity
android:name=".YourActivity"
android:theme="@style/MYTheme"/>

or try this

    getSupportActionBar().setElevation(0);


来源:https://stackoverflow.com/questions/45033408/android-app-masthead-display

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!