0% found this document useful (0 votes)
685 views2 pages

TextView vs EditText in Android

EditText is used for user input fields, where the text can be edited. TextView displays text that cannot be edited by the user, but can be programmatically changed by the app. Generally, EditText is used for text inputs and TextView is used for static labels or messages.

Uploaded by

ritesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
685 views2 pages

TextView vs EditText in Android

EditText is used for user input fields, where the text can be edited. TextView displays text that cannot be edited by the user, but can be programmatically changed by the app. Generally, EditText is used for text inputs and TextView is used for static labels or messages.

Uploaded by

ritesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

5/24/2016 androidEditTextvsTextViewStackOverflow

signup login tour help

_
StackOverflowisacommunityof4.7 JointheStackOverflowcommunityto:
millionprogrammers,justlikeyou,
helpingeachother.

Jointhemitonlytakesaminute:
Askprogramming Answerandhelp Getrecognizedforyour
Signup questions yourpeers expertise

EditTextvsTextView

IreadtheAPI'sandseethatTextViewisasuperclasstoEditText,butIhaveashortandsimplequestion:Generallyspeaking,EditTextisused
whenthetextdisplayedissbujecttochange,whetherit'[Link]
constant/[Link]?

Thanks!

android androidedittext textview

askedMay8'14at2:14
user2927724
82 1 6

Yes,[Link],andlettheuserfilloutthe
entiretext.DyrborgMay8'14at2:20

[Link],everything
isaviewsosometimesIuseaTextViewwithanonClickeventasabuttonwhentheneedswarrant(small
buttonsthatneedtolookconsistentacrossversions,simulatingacomboortogglebutton).Ijustapplythe
samegradientthatIuseonmybuttonsandtheylookthesame.GravitoidMay8'14at13:39

6Answers

Ifyouhavedoneanyjavaprojectsbefore,Isee Textview and EditText arejustsameas


JLabel and JtextField .IfyouwanttoaskusertoenterusernameyouwillsetanTextViewwith
("username"textinthat,likeyouwoulddothesameforJLabel).Andthenyoumakeatextbox
appearforusertoentertheusernamethattextboxis EditText .EditTextiswhereusergivetheir
inputsfortheprogram.

UsercannotchangesomethinginTextViewbutprogramcan(Afteruserinputcorrectusername
youcansettextforanotherTextViewbytheprogramsayingthat"Detailscorrect"ifyouwantthat
[Link]'tmakeitappear).Usercaninputanyuser
name,But"username"textfieldor TextView willremainunchangeas"username"justlikeina
normallogininterface.

answeredMay10'14at4:54
SMK
155 10

EditTextisusedforuserinput.

[Link]
programaticallyatanytime.

answeredMay8'14at2:25
Garret
689 5 16

[Link]
usertoViewtheText(suchasalabel,etc)andEditTextusedwhenyouwanttheusertobeable
[Link]
android:text parameter.

Thedocumentationprettymuchsumsitup:

EditTextisathinveneeroverTextViewthatconfiguresitselftobeeditable.

answeredMay8'14at4:53
ajacian81
4,372 7 31 54

[Link] 1/2
5/24/2016 androidEditTextvsTextViewStackOverflow

[Link]
input(displaykeyboard,paste,positionindicator,etc).

Ifyourappischangingthecontenttodisplay,[Link]
userhowevercannotmesswithit.

answeredMay8'14at2:21
EduardoBonet
307 3 8

TextViewisjustlikeLabeltagofHTMLontheotherhandEdittextisinputtype.

SimpletellingTextViewiscan'[Link].

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][Link]/reference/android/widget/TextView.htmlsilva96Aug26'15at18:30

[Link] 2/2

You might also like