Android - EditText keyboard type programmatically - Stack ...

文章推薦指數: 80 %
投票人數:10人

Android Keyboard Type - Stack Overflow Home Public Questions Tags Users Collectives ExploreCollectives FindaJob Jobs Companies Teams StackOverflowforTeams –Collaborateandshareknowledgewithaprivategroup. CreateafreeTeam WhatisTeams? Teams CreatefreeTeam CollectivesonStackOverflow Findcentralized,trustedcontentandcollaboratearoundthetechnologiesyouusemost. Learnmore Teams Q&Aforwork Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch. Learnmore Android-EditTextkeyboardtypeprogrammatically AskQuestion Asked 4years,1monthago Active 4years,1monthago Viewed 3ktimes 1 Itrytosetthekeyboardtypeofanedittext. WhenIusebelowcode,itchangesthefontoftheedittext'shint. setInputType(TYPE_CLASS_TEXT|TYPE_TEXT_VARIATION_PASSWORD); So,Itryanothersolution. setTransformationMethod(newPasswordTransformationMethod()); Icreateanedittext.Mypasswordisshownontopofthekeyboard.(lookslikeautosuggestion). HowcanIsetthekeyboardtypeforpasswordwithoutchangingthefontofthetext? androidandroid-edittextandroid-softkeyboard Share Follow askedSep29'17at7:27 us2956us2956 41699silverbadges2222bronzebadges Addacomment  |  3Answers 3 Active Oldest Votes 3 forFontissueyoucantrythis: editText.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_VARIATION_PASSWORD); editText.setTypeface(Typeface.DEFAULT); Share Follow answeredSep29'17at9:22 N.MoudgilN.Moudgil 53922silverbadges1010bronzebadges 1 Typeface.DEFAULTisnotenough.Seemyanswer. – us2956 Sep29'17at11:37 Addacomment  |  2 Solutionishere: typeface=edittext.getTypeface(); editText.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_VARIATION_PASSWORD); editText.setTypeface(typeface); Share Follow answeredSep29'17at11:35 us2956us2956 41699silverbadges2222bronzebadges Addacomment  |  -1 //thisworkforme,donotsetandroid:inputType="textPassword"inyourxmlfileandinstead,setitinjava editText.setTransformationMethod(newPasswordTransformationMethod()); Share Follow answeredSep29'17at18:43 jessicajessica 1,61311goldbadge1111silverbadges1616bronzebadges Addacomment  |  YourAnswer ThanksforcontributingananswertoStackOverflow!Pleasebesuretoanswerthequestion.Providedetailsandshareyourresearch!Butavoid…Askingforhelp,clarification,orrespondingtootheranswers.Makingstatementsbasedonopinion;backthemupwithreferencesorpersonalexperience.Tolearnmore,seeourtipsonwritinggreatanswers. Draftsaved Draftdiscarded Signuporlogin SignupusingGoogle SignupusingFacebook SignupusingEmailandPassword Submit Postasaguest Name Email Required,butnevershown PostYourAnswer Discard Byclicking“PostYourAnswer”,youagreetoourtermsofservice,privacypolicyandcookiepolicy Nottheansweryou'relookingfor?Browseotherquestionstaggedandroidandroid-edittextandroid-softkeyboardoraskyourownquestion. TheOverflowBlog Whoownsthisoutage?BuildingintelligentescalationchainsformodernSRE Podcast395:Whoisbuildingcloudsfortheindependentdeveloper? FeaturedonMeta Nowlive:Afullyresponsiveprofile Reducingtheweightofourfooter TwoBornottwoB-Farewell,BoltClockandBhargav! Visitchat Related 4135 Howdoyouclose/hidetheAndroidsoftkeyboardprogrammatically? 3058 HowtostopEditTextfromgainingfocusatActivitystartupinAndroid 2942 IsthereauniqueAndroiddeviceID? 787 What'sthebestwaytolimittextlengthofEditTextinAndroid 2137 Whatis'Context'onAndroid? 513 Howtoshowsoft-keyboardwhenedittextisfocused 980 PlacecursorattheendoftextinEditText 209 ProgrammaticallychangeinputtypeoftheEditTextfromPASSWORDtoNORMAL&viceversa 3843 ProperusecasesforAndroidUserManager.isUserAGoat()? HotNetworkQuestions WhydoesHebrews3:1callJesusanapostle? IsitlegalintheUStoleaveaguninthehandsofaminorwithoutoversight? Whydidn'ttheEnterprise-DsendaprobetolookforPicard? Does来mean"bring"? DoesaserverneedaGPU? IbrokemyGstringandmyother3stringsareoutoftunetoo Couldanyequationhavepredictedtheresultsofthissimulation? Foraspacecraftorbitingaplanet,orbitalspeedisinverselyproportionaltoorbitradius.Butspeedmustbeincreasedtoincreaseorbitradius? HowshouldIteachlogarithmstohighschoolstudents? Istherearootwordfor-scendo? Whatdoes'dosteakandchips'mean? Skippingcertainnumbersinalist In-TransitWaitingAreainUSAAirports? Howtoaskfriendnottoleavesoquickly,oratleastletmeknowifhedoesn'tplanonstayingverylong? HowtojustifysmallHomininsnotbeingconqueredby(anatomicallymodern)Humans? Needtolistanyreferencesforcommonknowledge? Whyisthepartialpressureofoxygeninbloodsameasthatinalveoli WhyistheSecondAmendmentstructureddifferentlyfromallotheramendments? Embeddingtorsorsofellipticcurvesintoprojectivespace HowcanIfitaglasscooktophoodintoaspacethat'stootight? Whichpart(s)hasthegreatestslopeofpriceperpound(kg)? Candefrostingvacuum-packedfishinitspackagingcausebotulism? WhataretheoptionsforaPCwithcoldresistanceanddarkvision? NewtoBikes:MychainfelloffandIputitbackon.HowcanIknowifit'sontherightcog? morehotquestions Questionfeed SubscribetoRSS Questionfeed TosubscribetothisRSSfeed,copyandpastethisURLintoyourRSSreader. default Yourprivacy Byclicking“Acceptallcookies”,youagreeStackExchangecanstorecookiesonyourdeviceanddiscloseinformationinaccordancewithourCookiePolicy. Acceptallcookies Customizesettings  



請為這篇文章評分?