Two questions about user applications ui and AlphaAnimation

Therefore, I really collect a lot of knowledge about settings and animations. Now I am going to skin my application with user interface elements, but I'm not sure if I am doing this correctly.

Basically I create an xml file in my folder with different button states and so on. Then in my xml styles, I create a custom (e.g.) checkbox style that references the xml checkbox. Then, in my xml layout, I create a normal checkbox and invoke the checkbox style I made. Works great, but I'm not sure if this is an effective approach?

Secondly, I study animation, and I feel that programming animations in Java is easier than XML, which leads me to AlphaAnimation (). Alpha animation requires two long variables. When I do AlphaAnimation (1,0), it gradually disappears, but I wanted it to disappear by 50%, and from what I learned in the XML version, I can do 0.5 to 50%. So I would type AlphaAnimation (1.05), but obviously this does not work. HOw do I keep doing this?

Thank!

0
source share
1 answer

1) Sounds quite reasonable and pretty much the standard way to do this.

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
+2
source

All Articles