Professional Documents
Culture Documents
_
StackOverflowisacommunityof4.7 JointheStackOverflowcommunityto:
millionprogrammers,justlikeyou,
helpingeachother.
Jointhemitonlytakesaminute:
Askprogramming Answerandhelp Getrecognizedforyour
Signup questions yourpeers expertise
EditTextvsTextView
IreadtheAPI'sandseethatTextViewisasuperclasstoEditText,butIhaveashortandsimplequestion:Generallyspeaking,EditTextisused
whenthetextdisplayedissbujecttochange,whetherit'sfromtheuserortheapp.TextViewisusedwhenthetextdisplayedistobe
constant/sameforever.Isthiscorrect?
Thanks!
askedMay8'14at2:14
user2927724
82 1 6
Yes,thatiscorrect.OftenyouwillevenleaveEditTextblankwithjustahint,andlettheuserfilloutthe
entiretext.DyrborgMay8'14at2:20
IuseaTextViewwhenthetextissubjecttochange.EditViewifexpectinguserinput.Ofinterest,everything
isaviewsosometimesIuseaTextViewwithanonClickeventasabuttonwhentheneedswarrant(small
buttonsthatneedtolookconsistentacrossversions,simulatingacomboortogglebutton).Ijustapplythe
samegradientthatIuseonmybuttonsandtheylookthesame.GravitoidMay8'14at13:39
6Answers
UsercannotchangesomethinginTextViewbutprogramcan(Afteruserinputcorrectusername
youcansettextforanotherTextViewbytheprogramsayingthat"Detailscorrect"ifyouwantthat
youhavetowriteitinyourprogramcode.Usercan'tmakeitappear).Usercaninputanyuser
name,But"username"textfieldor TextView willremainunchangeas"username"justlikeina
normallogininterface.
answeredMay10'14at4:54
SMK
155 10
EditTextisusedforuserinput.
TextViewisusedtodisplaytextandisnoteditablebytheuser.TextViewcanbeupdated
programaticallyatanytime.
answeredMay8'14at2:25
Garret
689 5 16
Thenamesofthemareprettyselfexplanatory.TextViewisthewidgetusedwhenyouwantthe
usertoViewtheText(suchasalabel,etc)andEditTextusedwhenyouwanttheusertobeable
toeditthetext.Thetextineitherwidgetcanbesetprogrammaticallyorviaxmlusingthe
android:text parameter.
Thedocumentationprettymuchsumsitup:
EditTextisathinveneeroverTextViewthatconfiguresitselftobeeditable.
answeredMay8'14at4:53
ajacian81
4,372 7 31 54
https://stackoverflow.com/questions/23531599/edittextvstextview 1/2
5/24/2016 androidEditTextvsTextViewStackOverflow
EditTextisusedwhenyouexpectaninputfromtheuser.EditTextprovidesthebehaviorforuser
input(displaykeyboard,paste,positionindicator,etc).
Ifyourappischangingthecontenttodisplay,youcanjustresetthetextfortheTextView.The
userhowevercannotmesswithit.
answeredMay8'14at2:21
EduardoBonet
307 3 8
TextViewisjustlikeLabeltagofHTMLontheotherhandEdittextisinputtype.
SimpletellingTextViewiscan'tchangablebytheuser.Useronlyentervalue.
answeredMar24'15at19:54
Ssingh
13 2
1 that'sabadcomparisonanHTMLlabelismuchmoreitalwaysbelongstoaformelement(ifyouclick
onalabel,thelinkedelementisfocused)...AlexanderMar24'15at20:12
EditTextisInputType/Fieldforinputtingtext
TextViewisTextFieldforshowingtext
answeredMay29'15at8:52
GiorgiTsiklauri
57 1 9
Notcorrect,fromTextViewDocumentation: Displaystexttotheuserandoptionallyallowsthemtoeditit.
[link]developer.android.com/reference/android/widget/TextView.htmlsilva96Aug26'15at18:30
https://stackoverflow.com/questions/23531599/edittextvstextview 2/2