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

2016年02月03日 Android 4条评论 阅读6105次

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
看了本文是不是觉得很赞,那就赶紧点击下面按钮分享给身边的朋友吧!

4 条评论

  1. 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/

  2. 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/

  3. 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]

  4. 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