我正在创建一个控制台或终端的东西,我遇到了问题。 Normaly我的活动看起来像这样:
但是当我点击edittext并且键盘打开我的edittextfield并且我的发送按钮消失了:
但我希望edittext和sendbutton位于keybaord之上,这样你就可以看到你正在键入的内容,并且你可以发送它。这是我的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>
也许有人知道,我怎么能解决这个问题!在此先感谢,任何帮助表示赞赏:)
答案 0 :(得分:1)
设置ScrollView
的{{1}}应该有效。试试这个
layout_weight=1