簡體   English   中英

Android中的EditText

[英]EditText in Android

我有edittext和edittext下面的一個按鈕。 edittext的寬度為fill_parent,高度為wrap_content。

我的消息全屏顯示,由於此原因我的按鈕不可見,因此隱藏在虛擬鍵盤下方

誰能解決這個問題。 謝謝。

替代文字替代文字

在與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>

嘗試將此插入到您的布局文件中,在其中您的edittext被調用:

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

另外,您底部的按鈕可能需要:

android:layout_alignParentBottom="true"

假設你想要的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