2010-10-08 79 views
1

我在edittext下面有edittext和一个按钮。 edittext的宽度为fill_parent,高度为wrap_content。Android中的EditText

我的邮件覆盖全屏幕,因为这是我的按钮是不可见的,它隐藏在下面的虚拟键盘

任何一个可以排序这个问题。 谢谢。

alt text alt text

+0

哪里码?屏幕截图没有用。 – Cristian 2010-10-08 15:54:21

回答

3

我已经受够了类似的东西是最成功的,但并不相同,安德鲁的解决方案:

<?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"> 
    <EditText 
     android:id="@+id/myedittext" 
     android:layout_width="fill_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" /> 
    <Button 
     android:id="@+id/mybutton" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="0" 
     android:text="this is my button"/> 
</LinearLayout> 
+0

安德鲁的解决方案是否有效?你对我看起来好多了,但虚拟键盘怎么样?! – Tima 2010-10-08 21:26:54

+0

“有效屏幕​​尺寸”将缩小以允许使用虚拟键盘,剩余空间将根据相同的布局排列。键盘会显示出来,按钮会要求它的空间,EditText会得到剩下的东西,这可能不会太多。 – beekeeper 2010-10-09 05:12:32

+0

听起来不错,我应该在星期一试试:) – Tima 2010-10-10 07:33:45

1

试着在你的EditText叫你的布局文件中插入这样的:

android:layout_above="@+id/ID OF YOUR BUTTON HERE" 

此外,您在底部按钮可能要求:

android:layout_alignParentBottom="true" 
+5

你怎么知道他在使用'RelativeLayout'? – Cristian 2010-10-08 15:53:39

1

假设你想要 EditText覆盖所有scr除了按钮EEN ...

<?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"> 
    <EditText 
     android:id="@+id/myedittext" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_weight="1" /> 
    <Button 
     android:id="@+id/mybutton" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="this is my button"/> 
</LinearLayout>