android:ToggleButton的默认显示文字要用setText指定

2016年02月03日 Android 8条评论 阅读6768次

android:ToggleButton的默认显示文字要用setText指定

android中ToggleButton可以为其设置textOn的文字也可以为其设置textOff的文字,但无论在xml布局文件还是java代码中设置textOn和textOff后,发现ToggleButton的默认显示文字还是最原始的开/关。 


正确的做法是要为ToggleButton设置Text信息,也就是调用TextView.setText(CharSequence)方法。


 设置的是ToggleButton的初始默认的显示文字:

setText(CharSequence);



设置的是ToggleButton的开启状态的显示文字:

setTextOn(CharSequence);



设置的是ToggleButton的关闭状态的显示文字:

setTextOff(CharSequence);



三种状态的文字是要分开设置的,使用时注意。
分享本文至:

WRITTEN BY

avatar
本文标签:androidToggleButton
看了本文是不是觉得很赞,那就赶紧点击下面按钮分享给身边的朋友吧!

8 条评论

  1. avatar cadeemy

    <a href="http://www.ctnwphoenix.com/adidas-ultra-boost-wei%C3%9F-billig-schuhej">adidas ultra boost wei脽 billig</a> <a href="http://www.nunninsurance.com/nike-free-trainer-5.0-orange-and-schwarz-schuhei">nike free trainer 5.0 orange and schwarz</a> <a href="http://www.bethliggett.com/nike-air-max-tn-gr%C3%B8nn-r%C3%B8d-obuvj">nike air max tn gr酶nn r酶d</a> <a href="http://www.mikashbaby.com/nike-air-force-1-gituttio-nike-air-force-1-low-scarpel">nike air force 1 gituttio nike air force 1 low</a> <a href="http://www.equidesquercy.com/nike-air-force-1-femmes-noir-and-blanc-chaussuresh">nike air force 1 femmes noir and blanc</a> <a href="http://www.sabatp.com/nike-hyperdunk-2015-flyknit-low-nero-blu-scarpeh">nike hyperdunk 2015 flyknit low nero blu</a>
    cadeemy http://www.cadeemy.com/

  2. avatar bgaddiict

    <a href="http://www.seesoshow.com/nike-lunarglide-6-wei%C3%9F-rosa-blau-schuhej">nike lunarglide 6 wei脽 rosa blau</a> <a href="http://www.crypolio.com/green-bay-packers-salary-cap-hath">green bay packers salary cap</a> <a href="http://www.vtrvideo.com/air-jordan-super.fly-5-noir-or-chaussuresh">air jordan super.fly 5 noir or</a> <a href="http://www.asoseinhalb.com/nike-sb-stefan-janoski-max-schwarz-on-schwarz-schuheh">nike sb stefan janoski max schwarz on schwarz</a> <a href="http://www.handydgh.com/nike-flyknit-air-max-women-light-blue-orange-black-shoesk">nike flyknit air max women light blue orange black</a> <a href="http://www.blakefanz.com/nike-free-run-4.0-r%C3%B8dnike-free-run-4.0-bl%C3%A5-skoj">nike free run 4.0 r酶dnike free run 4.0 bl氓</a>
    bgaddiict http://www.bgaddiict.com/

  3. avatar jbsbruxelles

    <a href="http://www.wiminfest.com/air-jordan-melo-m11-hvit-lilla-runningf">air jordan melo m11 hvit lilla</a> <a href="http://www.ankarasevgi.com/frau-nike-blazer-high-i-light-blau-wei%C3%9F-schuhei">frau nike blazer high i light blau wei脽</a> <a href="http://www.dientedeperro.com/baltimore-ravens-new-era-nfl-team-hashmark-39thirty-cap-hath">baltimore ravens new era nfl team hashmark 39thirty cap</a> <a href="http://www.goseegary.com/hombres-nike-air-max-2014-blanco-negro-trainersce">hombres nike air max 2014 blanco negro</a> <a href="http://www.djnickbarton.com/converse-chuck-schwarz-leder-schuhek">converse chuck schwarz leder</a> <a href="http://www.chotinaukri.com/jordan-prime-fly-2-verde-scarpeg">jordan prime fly 2 verde</a>
    jbsbruxelles http://www.jbsbruxelles.com/

  4. avatar enventsurvey

    <a href="http://www.mwartsdrama.com/air-jordan-eclipse-gul-gull-obuvi">air jordan eclipse gul gull</a> <a href="http://www.meshmotors.com/air-jordan-retro-6-gris-amarillo-zapatosp">air jordan retro 6 gris amarillo</a> <a href="http://www.aspenmedisys.com/coach-nylon-travel-bag-coachh">coach nylon travel bag</a> <a href="http://www.smartiesland.com/adidas-tubular-runner-blue-gold-shoesj">adidas tubular runner blue gold</a> <a href="http://www.emcetolerie.com/herre-nike-air-max-95-lyser%C3%B8d-gr%C3%B8n-skol">herre nike air max 95 lyser酶d gr酶n</a> <a href="http://www.lapaktoko.com/nike-lebron-11-lifestyle-rouge-chaussuresq">nike lebron 11 lifestyle rouge</a>
    enventsurvey http://www.enventsurvey.com/

  5. avatar bacaiptek

    <a href="http://www.diplomabroad.com/adidas-eqt-boost-schwarz-schuheh">adidas eqt boost schwarz</a> <a href="http://www.trechadental.com/adidas-pure-boost-2-grey-shoesk">adidas pure boost 2 grey</a> <a href="http://www.akhbarsanaye.com/adidas-pure-boost-triple-sort-skol">adidas pure boost triple sort</a> <a href="http://www.timxes.com/nike-mercurial-superfly-cr7-svart-gull-obuvk">nike mercurial superfly cr7 svart gull</a> <a href="http://www.leadercheetah.com/maschio-nike-internationalist-jcrd-weave-bianca-nero-scarpei">maschio nike internationalist jcrd weave bianca nero</a> <a href="http://www.arealleader.com/p%C3%BArpura-nike-kobe-zapatos-zapatosh">p煤rpura nike kobe zapatos</a>
    bacaiptek http://www.bacaiptek.com/

  6. avatar bethliggett

    <a href="http://www.douhenhar.com/nike-free-run-verde-and-negro-zapatosl">nike free run verde and negro</a> <a href="http://www.bigdstattoos.com/nike-roshe-one-black-and-gold-shoesk">nike roshe one black and gold</a> <a href="http://www.popuptucasa.com/nike-hypervenom-phantom-ii-high-tops-fg-brun-svart-hvit-obuvi">nike hypervenom phantom ii high tops fg brun svart hvit</a> <a href="http://www.mapspokemon.com/converse-sko-svart-high-tops-obuvk">converse sko svart high tops</a> <a href="http://www.aevibox.com/nike-air-huarache-run-ultra-gr%C3%B8nn-obuvi">nike air huarache run ultra gr酶nn</a> <a href="http://www.dikkertjedap.com/supra-skytop-blanco-zapatosl">supra skytop blanco</a>
    bethliggett http://www.bethliggett.com/

  7. avatar escortfeeds

    <a href="http://www.teamdalarna.com/air-jordan-retro-7-gamma-bl%C3%A5-hvid-skoj">air jordan retro 7 gamma bl氓 hvid</a> <a href="http://www.syairshamyoun.com/mennns-asics-gel-sendai-2-svart-bl%C3%A5-obuvi">mennns asics gel sendai 2 svart bl氓</a> <a href="http://www.fizalisfresh.com/hombres-nike-flyknit-lunar-3-naranja-p%C3%BArpura-zapatosk">hombres nike flyknit lunar 3 naranja p煤rpura</a> <a href="http://www.fsscas.com/nike-shox-torch-ii-lyser%C3%B8d-sort-skoq">nike shox torch ii lyser酶d sort</a> <a href="http://www.imagimp.com/femminile-air-yeezy-ii-2-sp-max-90-gituttio-nero-scarpeh">femminile air yeezy ii 2 sp max 90 gituttio nero</a> <a href="http://www.burmamaritime.com/maschio-nike-air-max-tailwind-6-nero-gituttio-scarpei">maschio nike air max tailwind 6 nero gituttio</a>
    [url=http://www.escortfeeds.com/]escortfeeds[/url]

  8. avatar bontontravel

    <a href="http://www.phantomlites.net/nike-flyknit-racer-bleu-tint-butye">nike flyknit racer bleu tint</a> <a href="http://www.pioneerspirit.net/adidas-ultra-boost-uncaged-hvid-yeezy-kurpesc">adidas ultra boost uncaged hvid yeezy</a> <a href="http://www.pizzablitzmd.net/nike-air-max-95-oro-shafts-butya">nike air max 95 oro shafts</a> <a href="http://www.pleinairjourney.net/air-jordan-5-retro-rosa-and-nero-velvet-schuheg">air jordan 5 retro rosa and nero velvet</a> <a href="http://www.powersellingmom.net/adidas-zx-flux-core-nero-rosso-butyf">adidas zx flux core nero rosso</a> <a href="http://www.pricespotter.net/air-jordan-5-retro-lyser%C3%B8d-and-sort-man-butya">air jordan 5 retro lyser酶d and sort man</a>
    bontontravel http://www.bontontravel.net/

欢迎留言




用户登录

sitemap