2012-01-21 3 views
5

안녕하세요 터미널이나 cmd 에서처럼 텍스트를 표시하려고합니다. 그리고 그 말은 각 입력에서 새로운 줄을 만들고 TextView의 하단 줄을 표시하는 텍스트 창을 의미하며 항상 화면에 일정량의 줄이 생깁니다.Textview는 터미널처럼 작동합니다.

쉽게 들릴 수는 있지만 지금은 시작한 방법을 잘 모릅니다.

나는이

<?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> 

다음

sss=et1.getText().toString(); 
tv1.append("\n"+sss); 

추가 할 새로운 라인

이 모든 일을하지만 난 정말 어떻게 만드는 아무 생각이 같은 ScrollViewTextView을 퍼팅 시도 TextView은 맨 아래로 가고, 지금은 최대한 많은 라인을 쳤을 때 끊어집니다.

누군가 내 프로그램을 저에게 쓸 것으로 기대하지 않습니다. 나는 여기 배울 것입니다

시간 내 주셔서 감사합니다!

답변

7

텍스트를 첨부 한 후 ScrollViewfullScroll(View.FOCUS_DOWN)으로 전화하십시오.

+0

감사합니다. 레이아웃 파일을 다시 작성해야했지만 제대로 작동했습니다. – DisibioAaron