Get rid of this line separator between my action-bar and pagertabview:

隐身守侯 提交于 2019-12-13 06:41:04

问题


I'm trying to get rid of this line separator between my action-bar and pagertabview:

How did Google achieve this?


回答1:


That isn't really a line separator, it is a shadow indicating that the Action Bar is at a higher elevation than the tab bar.

Assuming you are using AppCompat, you can use ViewCompat.setElevation() to set the elevation on your tabs for devices that support it (those running API 21+).

Your code might look something like this:

View tabs = findViewById(R.id.the_tabs_id)
ViewCompat.setElevation(tabs, getResources().getDimension(R.dimen.action_bar_elevation));

I am using 4dp as the action_bar_elevation dimension.

Pre 5.0:

  <style name="AppTheme" parent="@android:style/Theme.Holo.Light">
        <item name="android:windowContentOverlay">@null</item>
    </style>


来源:https://stackoverflow.com/questions/29608675/get-rid-of-this-line-separator-between-my-action-bar-and-pagertabview

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