【发布时间】:2016-01-23 19:31:59
【问题描述】:
我正在创建控制台或终端,但遇到了问题。通常我的活动看起来像这样:
但是当我点击edittext并且键盘打开我的edittextfield并且我的发送按钮消失了:
但我希望编辑文本和发送按钮位于键盘上方,这样您就可以看到您正在输入的内容并且可以发送它。这是我的 xml 代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#d1d1d1">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="477dp"
android:layout_below="@+id/title" >>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/textView"
android:text="Console:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="0dip"
android:gravity="top"
android:textSize="20sp"
android:textColor="#000000"
android:typeface="monospace"
android:paddingLeft="0dp"/>
</LinearLayout>
</ScrollView>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1">
<EditText
android:layout_marginLeft="5dp"
android:layout_width="163dp"
android:layout_height="wrap_content"
android:id="@+id/consoleText"
android:layout_weight="0.92" />
<Button
android:layout_width="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="5dp"
android:layout_height="wrap_content"
android:text="Send"
android:id="@+id/sendButton"
android:layout_gravity="right" />
</LinearLayout>
</LinearLayout>
也许有人知道,我该如何解决这个问题!在此先感谢,任何帮助表示赞赏:)
【问题讨论】: