First view results
In fact, it was discovered that tabactivity is not difficult to use. You only need to expand some of its methods to achieve the desired effect. If you don't want to talk about it, paste the animation implementation part, and view the source code for others.
@ Overridepublic void setcurrenttab (INT index) {int mcurrenttabid = getcurrenttab (); If (null! = Getcurrentview () {// This value is null when tab is set for the first time. If (isopenanimation) {If (mcurrenttabid = (mtabcount-1) & Index = 0) {getcurrentview (). startanimation (slideleftout);} else if (mcurrenttabid = 0 & Index = (mtabcount-1) {getcurrentview (). startanimation (sliderightout);} else if (index> mcurrenttabid) {getcurrentview (). startanimation (slideleftout);} else if (index <mcurrenttabid) {getcurrentview (). startanimation (sliderightout) ;}} super. setcurrenttab (INDEX); If (isopenanimation) {If (mcurrenttabid = (mtabcount-1) & Index = 0) {getcurrentview (). startanimation (slideleftin);} else if (mcurrenttabid = 0 & Index = (mtabcount-1) {getcurrentview (). startanimation (sliderightin);} else if (index> mcurrenttabid) {getcurrentview (). startanimation (slideleftin);} else if (index <mcurrenttabid) {getcurrentview (). startanimation (sliderightin );}}}
This program is android2.2.
However, it inherits the tabhost component class and extends its setcurrenttab (INT index) method. However, there is a bug that cannot be solved, so when you slide the screen continuously and quickly, when the view or activity background image loaded by the tabhost is transparent, a shadow occurs.
Hope you can solve the problem.
You can view the XML file to get the answer about the tag base. When using tabactivity, the top-level view of the layout file must be the tabhost control. You can see the source code of tabhost, it is actually a framelayout, which contains two controls: framelayout mtabcontent (displaying the view or activity we load) and tabwidget mtabwidget (displaying the tab is actually a linearlayout ), the default layout is system, so we can
In the XML file, you can change the order of the two items. Similarly, since we can get tabwidget, we can design its layout, the effect can be achieved.
Now I want to come. Will QQ, UC, and other beautiful button slide methods be implemented in this way? study ............
Complete code:Http://download.csdn.net/detail/cpcpc/3600134