目的:uniapp运行在安卓真机上,手机顶部原生导航(显示时间,电量,信号的那一栏),设置背景色且背景色一直固定在顶部
代码如下: <view class="status_bar">
<view class="top_view"></view>
</view>
.status_bar {
height: var(--status-bar-height);
width: 100%;
background: linear-gradient(90deg, #ff8d07 0%, #ff5602 100%);
}
.top_view {
height: var(--status-bar-height);
width: 100%;
position: fixed;
background: linear-gradient(90deg, #ff8d07 0%, #ff5602 100%);
top: 0;
z-index: 999;
}