안녕하세요~

 현재 만들려는  어플의 기능이,    버튼을 눌렀을때   텍스트뷰가 추가되는 기능인데,

 현재 버튼 클릭시 텍스트뷰가 추가가되고  (이전 텍스트뷰아래로) 계속 추가했을경우에,

 화면을 벗어나서 스크롤바가 생깁니다..  그런데;  자동으로 화면이 내려가지 않고,,

 스크롤바가 길어지고, 텍스트뷰만 계속 추가로 생기고요;;;   (첨부파일참조)
  
 자바 소스단에서 처리한건데;    처리방법이 잘못된건지;; 아니면 원래 이렇게 하면 안되는건지;;

 아시는분 조언좀 부탁드려요;;



 java 소스 쪽..


public class DynamicLayout extends Activity implements OnClickListener {
 private final int DYNAMIC_VIEW_ID2  = 0x7000;
 private final int MAX_DYNAMIC_VIEW = 99;
 private Button       pushButton;
 private Button       popButton;
 private TextView     statusText;
 private TextView     infoText;
 private LinearLayout dynamicLayout;
 private int          numButton = 0;
 
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
       
        pushButton = (Button)findViewById(R.id.pushButton);
        popButton  = (Button)findViewById(R.id.popButton);
        statusText = (TextView)findViewById(R.id.statusText);
        infoText   = (TextView)findViewById(R.id.infoText);
       
        pushButton.setOnClickListener(this);
        popButton.setOnClickListener(this);
       
        setStatusText(0);
        setInfoText(DYNAMIC_VIEW_ID2);
       
        dynamicLayout = (LinearLayout)findViewById(R.id.dynamicArea);
    }


.............................................................................
............................................................................. 



 private void pushButton() {     // Tv추가 버튼
  if ( numButton >= MAX_DYNAMIC_VIEW ) {
   return;
  }
  String tv1 = "Text";
  setStatusText(++numButton);
  
  TextView txtV = new TextView(this);
  txtV.setId(DYNAMIC_VIEW_ID2 + numButton);
  txtV.setText(tv1 + numButton);
  txtV.setGravity(Gravity.RIGHT);
  dynamicLayout.addView(txtV, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
  infoText.setText("Selected Button ID: " + DYNAMIC_VIEW_ID2 + numButton);
 }
 


xml 소스쪽..



<TextView android:id="@+id/statusText" 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textSize="20sp"
    android:text="Number of Button:" />
<LinearLayout
 android:orientation="horizontal"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content">
 <Button android:id="@+id/pushButton"
  android:text="Tv추가"
  android:layout_width="0dip"
  android:layout_height="wrap_content"
  android:layout_weight="50"/>
 <Button android:id="@+id/popButton"
  android:text="Tv삭제"
  android:layout_width="0dip"
  android:layout_height="wrap_content"
  android:layout_weight="50"/>
</LinearLayout>
<TextView android:id="@+id/infoText"
 android:text="Selected Button ID:"
 android:textSize="20sp"
 android:textColor="#000000"
 android:background="#FFFF00"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content" />
<LinearLayout android:id="@+id/dynamicArea"
 android:orientation="vertical"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content" />

<!--   이곳에  텍스트뷰가 추가가됨...   -->
</LinearLayout>




 다른글 검색해봤는데 xml에서 먼저 추가하고  java쪽에서 그걸 컨트롤로 했다고 하시는분도 계신데;
 그거 관련해서 검색해봤는데 ;  마땅한 답을 못 얻어서 질문드립니다;;  ㅠ  

 

 관련된 기능이나,  다른방법으로  구현을 해야하는지;;    비슷한 기능 써보신분들  조언 부탁드려요~~;;



 좋은하루 되세요~