【发布时间】:2017-06-05 20:17:10
【问题描述】:
我想让我固定在屏幕底部的文本字段随着键盘向上移动,基本上让它粘在键盘上。 This is how it looks without the keyboard, the element I want to move up with the keyboard is the footer. 当键盘弹出时,它现在会越过输入字段,因此您看不到您输入的内容。我该如何解决这个问题?提前致谢!
这部分的html:
<footer class="mdl-shadow--8dp">
<div class="mdl-textfield mdl-js-textfield">
<input class="mdl-textfield__input" type="text" id="addItemDescription">
<label class="mdl-textfield__label" for="addItemDescription">What do I need to do?</label>
</div>
<button id="addItemButton" class="mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect mdl-button--colored mdl-shadow--2dp">
<img class="material-icons" src="./res/material_icons/ic_add_white_24px.svg"></img>
</button>
</footer>
还有 CSS:
footer{
position: fixed;
z-index: 700;
text-align: center;
right: 0;
bottom: 0;
left: 0;
padding: 1rem;
background-color: #bdbdbd;
}
.mdl-textfield__label{
color: #4c4c4c;
font-size: 30px;
}
.mdl-textfield__label:after{
background: #f2f2f2;
}
.mdl-button--fab.mdl-button--colored {
background: #778f9b;
}
.mdl-button--fab.mdl-button--colored:hover {
background: #8d8d8d ;
}
#addItemButton{
position: absolute;
margin-left: 50px;
margin-top: -45px;
}
【问题讨论】:
-
您正在使用 android native 工作?或者你可以在清单文件中添加值吗?