Dis*_*ron 5 android textview android-layout
您好我正在尝试将文本显示为在终端或cmd中显示.我的意思是一个文本窗口,每个输入都会生成一个新行然后显示底线TextView,并且屏幕上总会有一定数量的行.
这听起来很容易,但是现在我开始了,我不知道该怎么做.
我试图把一个TextView在ScrollView这样的
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="100" >
<ScrollView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView android:id="@+id/tv1"
android:layout_width="wrap_content"
android:minLines="11"
android:maxLines="11"
android:layout_height="wrap_content"/>
</ScrollView>
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="10" >
<requestFocus />
</EditText>
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="10"
android:onClick="buttonclick"
android:text="Button" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
然后
sss=et1.getText().toString();
tv1.append("\n"+sss);
Run Code Online (Sandbox Code Playgroud)
添加新行
这一切都有效,但我真的不知道如何TextView进入底部,现在它只是在我达到最大线数时切断.
我绝对不希望有人为我编写我的程序.我在这里学习
谢谢你的时间!
| 归档时间: |
|
| 查看次数: |
2985 次 |
| 最近记录: |