从导航抽屉切换标签

时间:2016-12-18 16:41:25

标签: java android navigation-drawer

This is a picture of navigation drawer.

This is the picture of main activity

我有一个导航抽屉,在主要活动中我有3个标签。我想在导航抽屉点击标签之间切换。 就像我现在在服务选项卡中。但是当我在导航抽屉活动中点击Home时,我想看到Home选项卡。

1 个答案:

答案 0 :(得分:0)

正确的代码语法是 “主页”选项卡的int week1 = calendar1.get(Calendar.WEEK_OF_YEAR); int week2 = calendar2.get(Calendar.WEEK_OF_YEAR); int calendarWeekDifference = (week2 - week1);。 “服务”标签的public static int weeksTouched(Calendar fromDate, Calendar toDate){ DateTime fromDateTime = new DateTime(fromDate); DateTime toDateTime = new DateTime(toDate); DateTime epoch = new DateTime(0); Weeks fromWeeks = Weeks.weeksBetween(epoch, fromDateTime); Weeks toWeeks = Weeks.weeksBetween(epoch, toDateTime); int betweenWeeks = toWeeks.getWeeks() - fromWeeks.getWeeks(); return betweenWeeks; } 。 关于我们标签viewPager.setCurrentItem(0)

标签索引从0开始。

viewPager.setCurrentItem(1)