android


EditText new “row” after 25 characters


I want my EditText view to append a new "row" and not just a space between the characters when reaching 25.
<EditText
android:id="#+id/quote_field"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:layout_marginTop="35dp"
android:maxLines="3"
android:minLines="1"
android:maxLength="70"
android:singleLine="false"
android:gravity="top|center"
android:background="#drawable/textfield_bg"
android:textColor="#ffffff"
android:textSize="15sp"
android:imeOptions="actionSend"
android:imeActionLabel="Send"
android:inputType="text"
fontPath="fonts/VarelaRound-Regular.ttf"
tools:ignore="MissingPrefix"/>
then in Java I have a TextWatcher:
private class textChangeListener implements TextWatcher{
EditText textView;
private textChangeListener(EditText v){
this.textView = v;
}
#Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
#Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
#Override
public void afterTextChanged(Editable s) {
String input = textView.getText().toString();
if(input.length() == 25 && !isReached){
System.out.println("NEW LINE");
textView.append("\n");
isReached=true;
}
if(input.length() < 25 && isReached){
isReached=false;
}
}
}
the "\n" is only appending a "space" and not a new row. So I assume that's where it all fails.
Have you tried something like:
android:ems="12"
android:inputType="textMultiLine"

Related Links

After taking picture from camera image is not fitting to full screen in android
Firebase Authentication Failed - Expired Auth Token Discrepancy
IncompatibleClassChangeError in GCM for Android 24
Android Drag and Drop TextView goes missing if not dropped properly
Unable to center the image and text view in Android
How can I append data to json file with JsonWritter?
Can i give dangerous permissions from settings?
Constantly get error “HTTPClient::ReceiveTimeoutError” with my very simple calabash test case
How to define Text Color in Attributes files
Android Studio asking me to download the entire installation all over again
Adding TextView dynamically under the relativeLayout
Get current position of a mobile every 2 minutes android
C++ Builder: Get the model of an Android Device [duplicate]
How to receive json with same KEY i.e. “data” but different VALUE in every response with Retrofit 2.0 and Gson in android application.
universal image loader image position
Oauth Authentication For Own Service Access

Categories

HOME
facebook-oauth
wakanda
pagination
alexa-skills-kit
yandex
webix
computer-science
drop-down-menu
ibeacon-android
entitymanager
scsi
mathprog
chargify
vuejs
windows-xp
lilypond
microsoft-ocr
breadth-first-search
jquery-ias
systemtime
gmock
delimiter
entity-relationship-model
underscore.js
spotipy
errbot
sqsh
autodesk-designautomation
fstream
autolisp
imx6
sim-toolkit
password-protection
kill
visa
congestion-control
apollostack
httr
puredata
term
openrasta
cnc
mschart
netbeans6.8
tinkerpop
subnet
excel-dna
gpg-signature
baidu
android-instrumentation
rmongo
donations
rocks
angular2-testing
seek
preprocessor
expectations
gogs
eigenvector
jtwig
bizagi
gcloud-ruby
nupic
realsense
qt5.2
oracle-spatial
jdk1.7
dronekit-android
apache-commons-daemon
cwrsync
nutiteq
fits
java-security
pseudo-class
drupal-nodes
http-patch
ie8-compatibility-mode
gpars
insert-id
bjyauthorize
booksleeve
midlet
dajaxice
pyunit
subproject
thttpd
box2d-iphone
screen-size
xcelsius
google-ajax-api
w3c-geolocation
uideviceorientation
cfwindow
build-environment
lalr
business-model

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App