Scrollable vertically and horizontally EditText that doesn't automatically break text to the next line

前端 未结 2 811
暖寄归人
暖寄归人 2020-12-22 06:26

I need an activity that look like a simple text editor:
full-screen EditText with submit button below it.

Important:
1. EditText has to scroll both verti

2条回答
  •  南笙
    南笙 (楼主)
    2020-12-22 07:00

    EditText actually has scrolling already built in, so you don't have to use a ScrollView. The only thing is that it doesn't support flings.

    
    
        
    
        

    To stop the automatic wrapping, you can activate horizontal scrolling:

    EditText editText = (EditText) findViewById(R.id.some_edittext);
    editText.setHorizontallyScrolling(true);
    editText.setMovementMethod(new ScrollingMovementMethod());
    

提交回复
热议问题