2013-01-12 4 views
0

입력 텍스트가 맞지 않으면 왼쪽에서 오른쪽으로 자동 스크롤되는 TextView가 있습니다. 이제 텍스트가 맞지 않을 때 TextView에서 텍스트의 손을 가로로 스크롤하는 기능을 추가해야합니다. 그러면 사용자가 TextView의 내용을 볼 수 있습니다.가로 스크롤 가능 TextView

<HorizontalScrollView 
     android:id="@+id/horizontalScrollView" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_toLeftOf="@+id/btnBackspace" 
     android:layout_toRightOf="@+id/textViewLeftIndent" 
     android:fillViewport="true" > 

     <TextView 
      android:id="@+id/calculateField" 
      android:layout_width="534dp" 
      android:layout_height="wrap_content" 
      android:background="@color/lightgray" 
      android:focusable="true" 
      android:focusableInTouchMode="true" 
      android:gravity="center_vertical|right" 
      android:inputType="textImeMultiLine" 
      android:overScrollMode="ifContentScrolls" 
      android:scrollHorizontally="true" 
      android:text="" 
      android:textSize="80sp" > 

     </TextView> 

    </HorizontalScrollView> 

을하지만 지금은 가상 키보드 텍스트 뷰를 통해 편집이 전체 텍스트의 일부만을 (텍스트의 큰)를 스크롤 할 수 없습니다 : 나는 HorizontalScrollView에 텍스트 뷰를 추가 할 수 있습니다. 지금 작동하는 경우

답변

0

갱신

그것을 그렇지 않은 작품이

android:singleLine=”true” 
+0

감사를 추가하려면 텍스트 뷰 위젯

android:ellipsize="marquee" 

이를 추가하고 확인! 그것은 작동합니다. (왜 나는 당신의 메시지를 투표 할 수 없습니까?) 이제는 TextView를 클릭 할 때 가상 키보드가 나타나지 않도록해야하지만, TextView의 스크롤은 제대로 작동합니다. – leonidandand

+0

// TextView calculateField; calculateField.setText (result); horizontalScroll.fullScroll (HorizontalScrollView.FOCUS_RIGHT); 프로그래밍 방식으로 텍스트를 TextView에 추가 할 때마다 FullScroll (FOCUS_RIGHT) 메서드를 호출하여 TextView를 스크롤하지만 텍스트가 완전히 스크롤되지 않는 이유는 무엇입니까? - 보이지 않는 문자가 하나 있습니다. – leonidandand

+0

나는 그의 문제를 해결했습니다. 나는 ** android : ellipsize = "marquee"**를 ** android : ellipsize = "end"**로 변경 ** 활동을 보여줄 때만 작성하는 방법을 결정하고 TextView를 터치하면 화면 키보드에 나타나지 않습니다 (예 : 안드로이드 '스크린 키보드를 차단하는 방법) – leonidandand