Rom*_*dgz 1 xml android textview scrollable android-layout
我一直问这里或者我在这个布局上遇到的问题好几周了,所以这次我会展示一下我需要的东西:

我总是希望屏幕底部有一个EditText和一个按钮(当键盘出现时,它们必须出现在键盘上,而不是留在键盘下面).免费屏幕的其余部分必须是可滚动的TextView.
编辑:这是现在的代码,遵循罗曼的迹象.一切都按预期工作但滚动.TextView必须是可滚动的,而不是.怎么解决?
<?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">
<TextView
android:id="@+id/consola"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars = "vertical"
android:height="0dip"
android:layout_weight="1.0"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="bottom">
<EditText
android:id="@+id/editText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<Button
android:text="Conectar"
android:id="@+id/boton"
android:label="@string/enviar_string"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</Button>
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
你的布局太复杂了,这是你应该做的简略版本:
LinearLayout width=fill_parent height=fill_parent orientation=vertical
TextView width=fill_parent height=0dip layout_weight=1.0
EditText width=fill_parent height=wrap_content
Button width=fill_parent height=wrap_content
Run Code Online (Sandbox Code Playgroud)
TextView上的layout_weight是关键:它告诉父LinearLayout你想给这个TextView所有剩余的空白空间(这也是为什么高度设置为0dip.)
| 归档时间: |
|
| 查看次数: |
2414 次 |
| 最近记录: |