Android: How to avoid layout being pushed when keyboard invoked(Android:如何避免在调用键盘时推送布局)
问题描述
我的布局如下
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="1">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="wrap_content">
<Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
<Button android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
<Button android:text="Button" android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
<Button android:text="Button" android:id="@+id/button4" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
<Button android:text="Button" android:id="@+id/button5" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
</LinearLayout>
<ImageButton android:id="@+id/imageButton1" android:src="QGFuZHJvaWQ6ZHJhd2FibGUvc3RhdF9ub3RpZnlfc3luY19ub2FuaW0=" android:layout_height="fill_parent" android:layout_weight="1" android:layout_width="fill_parent"></ImageButton>
<EditText android:id="@+id/editText1" android:layout_height="wrap_content" android:layout_width="match_parent">
<requestFocus></requestFocus>
</EditText>
</LinearLayout>
当通过单击编辑文本调用软键盘时,整个布局被推送.我可以保持标题上的按钮固定并让图像视图被推送吗?因为按钮会像导航栏一样,所以即使布局被向上推,它也应该在那里.
when the softkeyboard invoked by clicking on the edit text the whole layou is being pushed. Can i keep the buttons on the header fixed and let the imageview being pushed?? Because buttons are gonna act like navigation bar so it should be there even when the layout is being pushed up.
之前
之后
推荐答案
在此处阅读文章:http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html
您应该在您的活动标签中添加清单 android:windowSoftInputMode="adjustResize" 参数.
Read article here: http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html
You should add in manifest android:windowSoftInputMode="adjustResize" parameter to your activity tag.
正确的标志是:android:windowSoftInputMode="adjustResize"
EDITED: Proper flag is: android:windowSoftInputMode="adjustResize"
这篇关于Android:如何避免在调用键盘时推送布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Android:如何避免在调用键盘时推送布局


- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- android 4中的android RadioButton问题 2022-01-01