Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pressed和enabled同时设置时,pressed状态未生效 #8

Closed
sankemao opened this issue Oct 28, 2019 · 2 comments
Closed

pressed和enabled同时设置时,pressed状态未生效 #8

sankemao opened this issue Oct 28, 2019 · 2 comments

Comments

@sankemao
Copy link

drawable_pressed_radius="@{25}"
drawable_pressed_solidColor="@{0xffff0000}"
drawable_radius="@{25}"
drawable_solidColor="@{0xffdadada}"
drawable_enabled_radius="@{25}"
drawable_enabled_solidColor="@{0xff007aff}"

@sankemao sankemao changed the title state_pressed和state_enabled同时设置时,pressed状态未生效 pressed和enabled同时设置时,pressed状态未生效 Oct 28, 2019
@sankemao
Copy link
Author

if (pressedDrawable != null) {
listDrawable.addState(new int[]{android.R.attr.state_pressed}, pressedDrawable);
}
if (enabledDrawable != null) {
listDrawable.addState(new int[]{android.R.attr.state_enabled}, enabledDrawable);
}
源码里,将pressedDrawable先于enabledDrawable放入,可以生效

@whataa whataa closed this as completed in 91ce50c Oct 29, 2019
@whataa
Copy link
Owner

whataa commented Oct 29, 2019

验证了下确实是,谢谢反馈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants