我有一个"保存"按钮,我想用软键盘一起推.因此,当用户单击布局中的EditText时,该按钮必须保持在键盘上方.现在按钮隐藏在键盘下方.你怎么做到这一点?
提前致谢!
我有3个autocompletetextview,我把它的适配器设置为ArrayAdapter<String>一个非常简单的textview布局.
的autocompletextview提示的结果是示出,但是屏幕上键盘下(我可以看到它的一部分).我怎样才能使结果显示在上方autocompletetextview而不是下方?
airline = (AutoCompleteTextView)findViewById(R.id.airline);
airline.setAdapter(new ArrayAdapter<String>(this, R.layout.autcomplete_dropdown, AIRLINES_AUTOCOMPLETE_ARRAY));
departLocation = (AutoCompleteTextView)findViewById(R.id.departLocation);
departLocation.setAdapter(new ArrayAdapter<String>(this, R.layout.autcomplete_dropdown, LOCATIONS_AUTOCOMPLETE_ARRAY));
arriveLocation = (AutoCompleteTextView)findViewById(R.id.arriveLocation);
arriveLocation.setAdapter(new ArrayAdapter<String>(this, R.layout.autcomplete_dropdown, LOCATIONS_AUTOCOMPLETE_ARRAY));
Run Code Online (Sandbox Code Playgroud) 假设我有一些关于 jetpack-compose 内容的活动
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
ScrollableColumn(
modifier = Modifier
.fillMaxSize()
.border(4.dp, Color.Red)
) {
val (text, setText) = remember { mutableStateOf("") }
TextField(
value = text,
onValueChange = setText,
label = {},
modifier = Modifier
.fillMaxWidth()
)
for (i in 0..100) {
Text("Item #$i")
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
如果我要启动此活动并专注于 TextField,则会弹出一个软件键盘。
但是,界面不会对此做出反应。ScrollableColumn 的底部边框 ( .border(4.dp, Color.Red)) 以及第 100 项 ( Text("Item #$i"))将不可见。
换言之,软键盘与内容重叠。
我怎样才能让喷气背包 compose 尊重可见区域的变化(由于软件键盘)?
How can I move button like below image :
tton when keyboard is show display.