开发者

How to put multiple selectors in one xml file and reference them from layout xml file?

开发者 https://www.devze.com 2023-03-18 12:42 出处:网络
I have a layout file with 6 image buttons. Each button should show different source image based selection/focus/noselection. I am able to

I have a layout file with 6 image buttons. Each button should show different source image based selection/focus/noselection. I am able to do this with 6 xml files under drawable folder with selector nodes.

Is there a way to put all these selector nodes in ONE xml file to accomplish the same. Less files means less开发者_如何学C management...


Yes but you must manage it from the code with:

public class MyClass extend Activity implements OnSelect,OnFocus

if you use eclipse write "On" and click ctrl+spaceBar and select what you need and change the icon with myButtonName.src="@drawble/myimageonselect"

0

精彩评论

暂无评论...
验证码 换一张
取 消