2011-07-02 2 views
9

나는 그러나 스크롤바 사람이 나에게 Sugesstion을 줄 수있는 가시 얻을 doesnot 작동 텍스트의안드로이드 Edittext에서 ScrollBar를 설정하는 방법?

questionEntry.setScroller(new Scroller(myContext)); 
questionEntry.setMaxLines(1); 
questionEntry.setVerticalScrollBarEnabled(true); 
questionEntry.setMovementMethod(new ScrollingMovementMethod()); 

scr0lling를 사용하여 때 구석 스크롤 목소에서 내가 EDITTEXT에 ScrollText에 원하고 또한 스크롤 막대 표시 안드로이드에 새로운 오전?

답변

17

이 정보는 도움이 될 수 있습니다.

<EditText android:id="@+id/edt_task_disc" android:layout_width="wrap_content" 
         android:layout_height="wrap_content" android:gravity="top" 
         android:background="@drawable/text_aerea" 
         android:hint="Task Discription" 
         android:textSize="15sp" android:paddingLeft="5dp" 
         android:maxHeight="35dp" 
         android:scrollbars="vertical" 
         /> 

텍스트를 편집의 당신의 XML 코드에 android:scrollbars="vertical"를 추가하고 그것을 잘 작동합니다 바랍니다.

3

자바 파일

EditText dwEdit = (EditText) findViewById(R.id.DwEdit); 

dwEdit.setOnTouchListener(new OnTouchListener() { 

       public boolean onTouch(View view, MotionEvent event) { 
        // TODO Auto-generated method stub 
        if (view.getId() ==R.id.DwEdit) { 
         view.getParent().requestDisallowInterceptTouchEvent(true); 
         switch (event.getAction()&MotionEvent.ACTION_MASK){ 
         case MotionEvent.ACTION_UP: 
          view.getParent().requestDisallowInterceptTouchEvent(false); 
          break; 
         } 
        } 
        return false; 
       } 
      }); 

그리고 당신의 XML 파일에서 만 샘플

...

<EditText 
     android:id="@+id/DwEdit" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="9" 
     android:ems="10" 
     android:gravity="top" 
     android:imeOptions="flagNoExtractUi" 

     android:minLines="10" 
     android:scrollHorizontally="false" 
     android:scrollbarAlwaysDrawVerticalTrack="true" 
     android:scrollbarStyle="insideInset" 
     android:scrollbars="vertical" 
     android:overScrollMode="always" 
     android:inputType="textCapSentences"> 
     </EditText> 
관련 문제