简体   繁体   English

Android中的EditText

[英]EditText in Android

I have edittext and a button below edittext. 我有edittext和edittext下面的一个按钮。 edittext has width as fill_parent and height as wrap_content. edittext的宽度为fill_parent,高度为wrap_content。

My messages covers full screen, due to this my button is not visible it hides below virtual keyboard 我的消息全屏显示,由于此原因我的按钮不可见,因此隐藏在虚拟键盘下方

can any one sort this problem. 谁能解决这个问题。 Thanks. 谢谢。

替代文字替代文字

I've had the most success with something similar, but not identical to, Andrew's solution: 在与Andrew解决方案类似但不完全相同的事情上,我取得了最大的成功:

<?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>

Try inserting this in your layout file where your edittext is called out: 尝试将此插入到您的布局文件中,在其中您的edittext被调用:

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

Also, your button at the bottom may require: 另外,您底部的按钮可能需要:

android:layout_alignParentBottom="true"

Assuming you WANT the EditText to cover all of the screen except for the button... 假设你想要的EditText覆盖所有屏幕除了按钮...

<?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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM