问题描述
我的布局如下
<?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="@android:drawable/stat_notify_sync_noanim" 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:如何避免在调用键盘时推送布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!