开发者

Two questions about custom app ui's and AlphaAnimation

So I'm really picking up a lot of knowledge about customizations and animations. Right now I'm skinning my app with custom UI elements, but I'm not sure if I'm doing this correctly.

Pretty much I'm creating a an xml file in my drawable folder with different button states and so forth. Then in my styles xml, I create a custom (for example) check box style referencing the check box xml. Then in my layout xml I create a normal checkbox and call the check box style I made. Works great, but I'm not sure if this is an efficient approach?

2nd, I'm learning animations and I feel that programming the animations in Java is easier then XML, which brings me to AlphaAnimation(). Alpha animation requires two long variables. When I do AlphaAnimation(1,0), it fades out fine, but I wanted to have it fade out 50% and from what I've learned in the XML version, I can do 0.5 as 50%. So I woul开发者_如何学Pythond type AlphaAnimation(1,05), but obviously that doesn't work. HOw do I go about doing that?

Thanks!


1) Sound quite reasonable and pretty much the standard way to do it.

2) You are very close:

AlphaAnimation alpha = new AlphaAnimation (1f, 0.5f); // from 100% visible to 50%
alpha.setDuration (1000); // 1 second, or whatever you want

// all your code here

myView.startAnimation(alpha); // execute it after a click or the event you want
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜