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

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

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 daddeaze

    <a href="http://www.khalataxi.com/nike-air-max-95-obsidian-cool-grey-runningf">nike air max 95 obsidian cool grey</a> <a href="http://www.miaclearbras.com/nfl-pittsburgh-steelers-color-rush-limited-antonio-brown-mens-football-jersey-nflv">nfl pittsburgh steelers color rush limited antonio brown mens football jersey</a> <a href="http://www.divyangbazar.com/womens-nike-free-run-2-ext-trainers-trainersa">womens nike free run 2 ext trainers</a> <a href="http://www.dixiepundit.com/mujeres-nike-huarache-ultra-blanco-verde-scarpec">mujeres nike huarache ultra blanco verde</a> <a href="http://www.ifshaildamage.com/nike-free-run-5.0-v4-dam%C3%A4nner-laufen-schuhe-online-kurpesc">nike free run 5.0 v4 dam盲nner laufen schuhe online</a> <a href="http://www.nanterrelec.com/discount-ray-ban-rb3467-polarized-sunglassesg">discount ray ban rb3467 polarized</a>
    daddeaze http://www.daddeaze.com/

  2. avatar yolohostelrio

    <a href="http://www.perlai.com/ua-curry-3-s%C3%B8lv-bl%C3%A5-obuvc">ua curry 3 s酶lv bl氓</a> <a href="http://www.robotultra.com/roshe-run-ps-td-rojo-negro-scarpea">roshe run ps td rojo negro</a> <a href="http://www.sphygmic.com/nike-sb-high-royal-blau-chaussuresg">nike sb high royal blau</a> <a href="http://www.swellvelo.com/herren-salomon-xt-wings-3-silber-rosa-kurpese">herren salomon xt wings 3 silber rosa</a> <a href="http://www.angguvenlik.com/nike-free-og-gituttio-obuva">nike free og gituttio</a> <a href="http://www.boigemenskap.com/ralph-lauren-swimwear-grau-khaki-polot">ralph lauren swimwear grau khaki</a>
    yolohostelrio http://www.yolohostelrio.com/

  3. avatar jotrdesigns

    <a href="http://www.inboundhead.com/nike-kyrie-1-grigio-arancia-rosso-butyf">nike kyrie 1 grigio arancia rosso</a> <a href="http://www.rxhealthforca.com/nike-roshe-run-wolf-grau-wei%C3%9F-obuvf">nike roshe run wolf grau wei脽</a> <a href="http://www.servistylo.com/hommes-salomon-xt-hornet-rose-bleu-obuve">hommes salomon xt hornet rose bleu</a> <a href="http://www.wedocounters.com/adidas-neo-l%C3%A6der-himmelbl%C3%A5-gr%C3%B8n-kurpesg">adidas neo l忙der himmelbl氓 gr酶n</a> <a href="http://www.acebelfast.com/hombres-nike-free-run-2-oro-gris-obuvc">hombres nike free run 2 oro gris</a> <a href="http://www.airistontili.com/new-balance-890-grigio-rosa-butya">new balance 890 grigio rosa</a>
    jotrdesigns http://www.jotrdesigns.com/

  4. avatar bobaprentiss

    <a href="http://www.byedrinkusa.com/nike-air-max-95-20th-verde-marrone-scarpec">nike air max 95 20th verde marrone</a> <a href="http://www.chilliflirt.com/nike-free-5.0-bianca-nero-kurpesf">nike free 5.0 bianca nero</a> <a href="http://www.cwjyun.com/nike-blazer-blum%C3%A4nner-wei%C3%9F-rot-scarpea">nike blazer blum盲nner wei脽 rot</a> <a href="http://www.educateinvest.com/nike-mercurial-finale-ii-ic-cleats-rot-schwarz-fluorescent-gr%C3%BCn-obuvc">nike mercurial finale ii ic cleats rot schwarz fluorescent gr眉n</a> <a href="http://www.eyegit.com/vibram-fivefingers-classic-gituttio-viola-chaussuresd">vibram fivefingers classic gituttio viola</a> <a href="http://www.flkgjkg.com/nike-kobe-elite-gr%C3%A5-kurpesg">nike kobe elite gr氓</a>
    bobaprentiss http://www.bobaprentiss.com/

  5. avatar mikespothole

    <a href="http://www.praiseti.com/adidas-zx-750-blau-gelb-rot-kurpesd">adidas zx 750 blau gelb rot</a> <a href="http://www.cynshq.com/discount-oakley-holbrook-prizm-lenses-sunglassesd">discount oakley holbrook prizm lenses</a> <a href="http://www.fnjcompressor.com/draymond-green-yellow-jersey-nflr">draymond green yellow jersey</a> <a href="http://www.kifftradingco.com/cheap-jordan-bel-air-5-skoa">cheap jordan bel air 5</a> <a href="http://www.phaqtory.com/jordan-12-olympic-cool-gray-sneakerf">jordan 12 olympic cool gray</a> <a href="http://www.cialislaw.com/reebok-hexahte-dark-bl%C3%A5-orange-kurpesa">reebok hexahte dark bl氓 orange</a>
    mikespothole http://www.mikespothole.com/

  6. avatar renostretch

    <a href="http://www.reicsignup.com/femmes-new-balance-990-bleu-butye">femmes new balance 990 bleu</a> <a href="http://www.royalpinkwax.com/nike-flyknit-lunar-3-hvid-obuve">nike flyknit lunar 3 hvid</a> <a href="http://www.sabiscareer.com/nike-kaishi-arancia-va-obuvd">nike kaishi arancia va</a> <a href="http://www.truckent.com/herren-nike-free-tr-wei%C3%9F-lila-kurpesf">herren nike free tr wei脽 lila</a> <a href="http://www.asvencon.com/adidas-neo-high-tops-kvinners-gul-obuvb">adidas neo high tops kvinners gul</a> <a href="http://www.bitcoincolin.com/kyrie-2-gr%C3%BCn-glow-mp3-butya">kyrie 2 gr眉n glow mp3</a>
    renostretch http://www.renostretch.com/

  7. avatar oriturk

    <a href="http://www.javlust.com/nike-free-rn-distance-gr%C3%A5-butya">nike free rn distance gr氓</a> <a href="http://www.postmatespro.com/nike-ash-womens-frank-gore-name-number-logo-nfl-21-miami-dolphins-long-sleeve-t-shirt-nflu">nike ash womens frank gore name number logo nfl 21 miami dolphins long sleeve t shirt</a> <a href="http://www.uilstrategie.com/nike-hyperdunk-2014-mujeres-verde-amarillo-kurpesb">nike hyperdunk 2014 mujeres verde amarillo</a> <a href="http://www.youtubetune.com/air-jordan-retro-12-noir-argent-schuhec">air jordan retro 12 noir argent</a> <a href="http://www.carbonstalk.com/nike-zoom-pegasus-32-oransje-gul-schuheg">nike zoom pegasus 32 oransje gul</a> <a href="http://www.gospeedbird.com/nike-flyknit-lunar-2-dam%C3%A4nner-grau-queen-kurpesc">nike flyknit lunar 2 dam盲nner grau queen</a>
    [url=http://www.oriturk.com/]oriturk[/url]

  8. avatar miuwhy36

    <a href="http://www.80hhid24.com/air-jordan-7-retro-infrarot-yoga-scarpec">air jordan 7 retro infrarot yoga</a> <a href="http://www.ia085owq.com/air-jordan-xi-11-negro-gamma-azul-schuhee">air jordan xi 11 negro gamma azul</a> <a href="http://www.pbco924y.com/adidas-zx-flux-nps-sneaker-dam%C3%A6nd-scarpef">adidas zx flux nps sneaker dam忙nd</a> <a href="http://www.x264x2xm.com/bon-march%C3%A9-jordan-11-rouge-velvet-scarpeg">bon march茅 jordan 11 rouge velvet</a> <a href="http://www.ghyez348.com/nike-mercurial-superfly-v-fg-noir-jaune-kurpesa">nike mercurial superfly v fg noir jaune</a> <a href="http://www.2cxikp05.com/ua-clutchfit-drive-plata-oro-schuhee">ua clutchfit drive plata oro</a>
    miuwhy36 http://www.miuwhy36.com/

欢迎留言




用户登录

sitemap