This does not mean the switch of the tab, but the internal jump in a single tab.
For example, there is a tabwidget, for example, there are four activity A, B, C, and D on it, and then there is a button on a to redirect the implementation to activityx. IfCodeFor example:
Intent intent = new intent (Aactivity. This, xxactivity. Class );
Startactivity (intent );
Finish ();
After the command is executed, it only enters activityx, but the following tabwidget disappears.
The effect we want is to switch to activityx, while maintaining the following tabwidget, which is similar to the navigation function in uitarbar of the iPhone.
Online distress has a lot of results, but the solution is also messy.
Solution 1: Activity + tabhost + activitygroup
HoweverActivitygroupGoogle has been deprecated, and its official recommendation is to use fragment, so I have not tried this method.
ActivitygroupFor more information, see
Partition activity in Android tabhost
Solution 2: fragment + tabhost + fragmentactivity
FragmentIs only after 3.0 features, but before this SDK can be added extension package (android-support-v4) to achieve its function.
Fragement use can refer to http://marshal.easymorse.com /? S = Fragment
Mhost. addtab (mhost. newtabspec (
"Tab1"
). Setindicator (
"Tab1"
). Setcontent (
New
Intent (maintabactivity.
This
, Fragmentactivity1.
Class
)));
In this way, the tab is a fragemntactivity, and fragment can be added to the fragemntactivity for management.
For details about how to implement the tab, refer
Android tabhost with fragmentactivity
Iii. Conjecture: fragmentactivity
Previously, fragment was used to implement a master-Details interface, similar to the uisplitview in the iPhone. Its principle is to divide the fragmentactivity interface into two pieces, and then add and manage fragment to and from the left. On the right side of the page, you can also jump to the activity. As a result, if you divide the fragmentactivity view into the upper and lower two parts, the following is a tab form!
Try to find time ~