关于真机调试的问题,请老师帮忙解答下疑问
问题描述:
老师,为什么安卓手机和苹果手机调试时显示的内容不一样啊?难道不是统一的吗?
相关截图:
这是安卓手机显示的,标题在右边,导航小图标也不显示,搜索框点击placeholder的文字就缩小了
这是苹果手机显示的,基本上都正常,但是搜索框光标是靠右的,但输入文字又是居中的

28
收起
正在回答 回答被采纳积分+1
3回答
好帮手慕言
2021-06-11 14:07:03
同学你好,解答如下:
1、标题显示的位置和手机系统有关,Android系统上标题居左显示,IOS系统上标题是居中显示的。自定义导航栏可以解决这个问题,如下:
index.wxml
<view class="custom flex_center" style="padding-top:{{statusBarHeight}}px">
<p>慕课</p>
</view>
<view class="empty_custom" style="padding-top:{{statusBarHeight}}px">
</view>
<view class="header">
<input type="text" class="header-input" placeholder="AngularJS·MySQL·Java" placeholder-class="header-input-placeholder" bindinput="handleInputChange" />
<icon type="search" class="header-input-icon" size="13" wx:if="{{showIcon}}" />
</view>index.wxss
.custom{
position: fixed;
width: 100%;
top: 0;
left: 0;
height: 45px;
z-index: 999;
text-align: center;
color:#000;
}
.custom p{
width: 100%;
display: block;
line-height: 45px;
color: #000;
font-size: 35rpx;
font-weight: 500;
max-width: 280rpx;
position: relative;
top: 25px;
left:30%;
}
/* 占位符 */
.empty_custom{
height: 50px;
width: 100%;
}index.json
{
"usingComponents": {},
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTextStyle": "black"
}app.json
"window": {
"navigationStyle": "custom"
},app.js
App({
globalData:{
// 头部的自定义高度
statusBarHeight: wx.getSystemInfoSync()['statusBarHeight'],
}
})2、老师这边在Android系统测试,图标是可以显示出来的。搜索框的提示文字不影响整体效果,可以忽略。
祝学习愉快~



恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星