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

Move Android bitmap/canvas away from the top left
Populate Android Gallery from image file paths?
How to determine if a home screen shortcut exists?
Sqlite close() was never explicitly called on database - I tried but failed
ftrace on android?
Missing separator when trying to ndk build
Access profile images of the people from their twitter account in Android
How to get images with respect to the selection of custom Localization?
set cache image as contact photo
Buttons with multiline text sink under alignment line, how to fix it?
Where to invoke a notification dialog box in a program with two classes
How to create message queues by using JNI in android app
TouchesBegan always fire when using TouchesMoved
How to create a Facebook event using Graph API
How to stop thread until user responds
How to launch french qwerty keyboard from the application?

Categories

HOME
batch-file
beautifulsoup
fuelux
cheerio
c99
ecmascript-6
apache-spark-mllib
obfuscation
mstest
devise
nuget
r-googlesheets
yandex
cakephp-3.4
tvos
iis-6
frontend
augeas
g++
vimdiff
startup
automatic-ref-counting
do-while
parameter-passing
entitymanager
scsi
symfony-2.8
vuejs
soci
bourbon
kendo-mobile
spring-async
ember-cli
perlbrew
ckfinder
itunes
asymptotic-complexity
winexe
constexpr
dumpbin
gojs
contacts
android-maps-extensions
sharding
processwire
servicestack-text
git-rewrite-history
typesafe-config
vmware-fusion
apriori
parser-generator
claims
oim
opencmis
user-defined-fields
twilio-click-to-call
convex-optimization
edit
skin
arules
reachability
pure-css
flex-monkey
pacemaker
synonym
udpclient
clipboard.js
google-query-language
sklearn-pandas
html-to-pdf
beanstalk
user-management
phpgrid
opl
grgit
rate-limiting
slash
lasso
uncompress
dnssec
nutiteq
kubuntu
mmwormhole
apache-spark-1.3
big-ip
jqmodal
functional-java
printdialog
cffile
preload
qtconcurrent
faye
extconf.rb
objectquery
usertype
cross-database
dot-emacs
openfaces
contentpresenter

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