Selector设置button三种背景颜色状态Demo

上传者: pigdreams | 上传时间: 2021-06-25 14:08:01 | 文件大小: 126KB | 文件类型: ZIP
描述:有时候button需要有多种不同的状态对应不同的背景,如正常状态下颜色是紫色,但按下状态是绿色,不可点状态是灰色,对应的三种不同背景颜色。 实现:要实现按钮按下状态,可点状态,对应状态下不同的颜色,需要为selector设置三个item来对应不同状态,以实现不同背景颜色。

文件下载

资源详情

[{"title":"( 66 个子文件 126KB ) Selector设置button三种背景颜色状态Demo","children":[{"title":"UI_design_demo","children":[{"title":"gradlew <span style='color:#111;'> 4.85KB </span>","children":null,"spread":false},{"title":"settings.gradle <span style='color:#111;'> 16B </span>","children":null,"spread":false},{"title":"UI_design_demo.iml <span style='color:#111;'> 868B </span>","children":null,"spread":false},{"title":".idea","children":[{"title":"libraries","children":[{"title":"junit_4_12.xml <span style='color:#111;'> 477B </span>","children":null,"spread":false},{"title":"javax_inject_1.xml <span style='color:#111;'> 324B </span>","children":null,"spread":false},{"title":"support_media_compat_25_0_1.xml <span style='color:#111;'> 981B </span>","children":null,"spread":false},{"title":"support_v4_25_0_1.xml <span style='color:#111;'> 420B </span>","children":null,"spread":false},{"title":"javax_annotation_api_1_2.xml <span style='color:#111;'> 358B </span>","children":null,"spread":false},{"title":"exposed_instrumentation_api_publish_0_5.xml <span style='color:#111;'> 708B </span>","children":null,"spread":false},{"title":"hamcrest_library_1_3.xml <span style='color:#111;'> 342B </span>","children":null,"spread":false},{"title":"espresso_idling_resource_2_2_2.xml <span style='color:#111;'> 690B </span>","children":null,"spread":false},{"title":"support_fragment_25_0_1.xml <span style='color:#111;'> 953B </span>","children":null,"spread":false},{"title":"support_compat_25_0_1.xml <span style='color:#111;'> 939B </span>","children":null,"spread":false},{"title":"hamcrest_core_1_3.xml <span style='color:#111;'> 526B </span>","children":null,"spread":false},{"title":"support_annotations_25_0_1.xml <span style='color:#111;'> 511B </span>","children":null,"spread":false},{"title":"jsr305_2_0_1.xml <span style='color:#111;'> 330B </span>","children":null,"spread":false},{"title":"hamcrest_integration_1_3.xml <span style='color:#111;'> 354B </span>","children":null,"spread":false},{"title":"espresso_core_2_2_2.xml <span style='color:#111;'> 635B </span>","children":null,"spread":false},{"title":"appcompat_v7_25_0_1.xml <span style='color:#111;'> 769B </span>","children":null,"spread":false},{"title":"support_core_utils_25_0_1.xml <span style='color:#111;'> 967B </span>","children":null,"spread":false},{"title":"rules_0_5.xml <span style='color:#111;'> 729B </span>","children":null,"spread":false},{"title":"animated_vector_drawable_25_0_1.xml <span style='color:#111;'> 653B </span>","children":null,"spread":false},{"title":"support_vector_drawable_25_0_1.xml <span style='color:#111;'> 648B </span>","children":null,"spread":false},{"title":"javawriter_2_1_1.xml <span style='color:#111;'> 330B </span>","children":null,"spread":false},{"title":"runner_0_5.xml <span style='color:#111;'> 735B </span>","children":null,"spread":false},{"title":"support_core_ui_25_0_1.xml <span style='color:#111;'> 946B </span>","children":null,"spread":false}],"spread":false},{"title":"runConfigurations.xml <span style='color:#111;'> 564B </span>","children":null,"spread":false},{"title":"misc.xml <span style='color:#111;'> 6.16KB </span>","children":null,"spread":false},{"title":"compiler.xml <span style='color:#111;'> 686B </span>","children":null,"spread":false},{"title":"workspace.xml <span style='color:#111;'> 161.16KB </span>","children":null,"spread":false},{"title":"markdown-navigator","children":[{"title":"profiles_settings.xml <span style='color:#111;'> 92B </span>","children":null,"spread":false}],"spread":true},{"title":"dictionaries","children":[{"title":"pigs_acer.xml <span style='color:#111;'> 90B </span>","children":null,"spread":false}],"spread":true},{"title":"gradle.xml <span style='color:#111;'> 626B </span>","children":null,"spread":false},{"title":"encodings.xml <span style='color:#111;'> 159B </span>","children":null,"spread":false},{"title":"modules.xml <span style='color:#111;'> 365B </span>","children":null,"spread":false},{"title":"copyright","children":[{"title":"profiles_settings.xml <span style='color:#111;'> 76B </span>","children":null,"spread":false}],"spread":false}],"spread":false},{"title":"gradle","children":[{"title":"wrapper","children":[{"title":"gradle-wrapper.properties <span style='color:#111;'> 233B </span>","children":null,"spread":false},{"title":"gradle-wrapper.jar <span style='color:#111;'> 52.38KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":".gradle","children":[{"title":"2.14.1","children":null,"spread":false}],"spread":true},{"title":"local.properties <span style='color:#111;'> 436B </span>","children":null,"spread":false},{"title":"gradlew.bat <span style='color:#111;'> 2.35KB </span>","children":null,"spread":false},{"title":"gradle.properties <span style='color:#111;'> 747B </span>","children":null,"spread":false},{"title":".gitignore <span style='color:#111;'> 127B </span>","children":null,"spread":false},{"title":"app","children":[{"title":"src","children":[{"title":"androidTest","children":[{"title":"java","children":[{"title":"com","children":[{"title":"hapzhu","children":[{"title":"ui_design_demo","children":[{"title":"ExampleInstrumentedTest.java <span style='color:#111;'> 780B </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":true}],"spread":true},{"title":"test","children":[{"title":"java","children":[{"title":"com","children":[{"title":"hapzhu","children":[{"title":"ui_design_demo","children":[{"title":"ExampleUnitTest.java <span style='color:#111;'> 419B </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":true},{"title":"main","children":[{"title":"AndroidManifest.xml <span style='color:#111;'> 684B </span>","children":null,"spread":false},{"title":"res","children":[{"title":"mipmap-hdpi","children":[{"title":"ic_launcher.png <span style='color:#111;'> 3.34KB </span>","children":null,"spread":false}],"spread":false},{"title":"mipmap-xxxhdpi","children":[{"title":"ic_launcher.png <span style='color:#111;'> 10.24KB </span>","children":null,"spread":false}],"spread":false},{"title":"mipmap-xhdpi","children":[{"title":"ic_launcher.png <span style='color:#111;'> 4.73KB </span>","children":null,"spread":false}],"spread":false},{"title":"mipmap-mdpi","children":[{"title":"ic_launcher.png <span style='color:#111;'> 2.15KB </span>","children":null,"spread":false}],"spread":false},{"title":"drawable","children":[{"title":"selector_bg_button.xml <span style='color:#111;'> 485B </span>","children":null,"spread":false},{"title":"shape_bg_button_unpress.xml <span style='color:#111;'> 408B </span>","children":null,"spread":false},{"title":"shape_bg_button_onpress.xml <span style='color:#111;'> 440B </span>","children":null,"spread":false},{"title":"shape_bg_button_no_enable.xml <span style='color:#111;'> 432B </span>","children":null,"spread":false}],"spread":false},{"title":"layout","children":[{"title":"activity_main.xml <span style='color:#111;'> 1.57KB </span>","children":null,"spread":false}],"spread":false},{"title":"values-w820dp","children":[{"title":"dimens.xml <span style='color:#111;'> 364B </span>","children":null,"spread":false}],"spread":false},{"title":"values","children":[{"title":"colors.xml <span style='color:#111;'> 214B </span>","children":null,"spread":false},{"title":"strings.xml <span style='color:#111;'> 80B </span>","children":null,"spread":false},{"title":"styles.xml <span style='color:#111;'> 394B </span>","children":null,"spread":false},{"title":"dimens.xml <span style='color:#111;'> 216B </span>","children":null,"spread":false}],"spread":false},{"title":"mipmap-xxhdpi","children":[{"title":"ic_launcher.png <span style='color:#111;'> 7.54KB </span>","children":null,"spread":false}],"spread":false}],"spread":false},{"title":"java","children":[{"title":"com","children":[{"title":"hapzhu","children":[{"title":"ui_design_demo","children":[{"title":"MainActivity.java <span style='color:#111;'> 1.15KB </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":true},{"title":"libs","children":null,"spread":false},{"title":"app.iml <span style='color:#111;'> 12.78KB </span>","children":null,"spread":false},{"title":".gitignore <span style='color:#111;'> 8B </span>","children":null,"spread":false},{"title":"build.gradle <span style='color:#111;'> 902B </span>","children":null,"spread":false},{"title":"proguard-rules.pro <span style='color:#111;'> 670B </span>","children":null,"spread":false}],"spread":true},{"title":"build.gradle <span style='color:#111;'> 521B </span>","children":null,"spread":false}],"spread":false}],"spread":true}]

评论信息

  • liqin19870815 :
    很好用 重要的是不需要图片 只需要修改颜色就可以 这个很方便 可以不受限制 很不错的资源 谢谢楼主的大方
    2019-07-19
  • daringpig :
    不错,挺好的资源~
    2018-10-16
  • ttccv :
    感谢楼主分享
    2018-10-08
  • chinalintd :
    不错,用上了,谢谢!
    2018-08-24
  • u010433738 :
    不错,对我很有帮助
    2017-12-04

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明