使用Intent从另一个活动打开Tab

时间:2017-06-08 19:25:06

标签: android android-intent android-activity tabs

我在特定活动中有4个标签,我还有另一个活动,我想打开其中一个标签

private void setupTabIcons() {

    ImageView tabOne = (ImageView) LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
    tabOne.setImageResource(R.drawable.ic_wall);
    //setImageAlpha(0, R.drawable.ic_tab_favourite, 0, 0);
    // this is the tab I want to open 
    tabLayout.getTabAt(0).setCustomView(tabOne);

    ImageView tabTwo = (ImageView) LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
    tabTwo.setImageResource(R.drawable.ic_blog);
    tabLayout.getTabAt(1).setCustomView(tabTwo);

    ImageView tabThree = (ImageView) LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
    tabThree.setImageResource(R.drawable.ic_special_feature);
    tabLayout.getTabAt(2).setCustomView(tabThree);

    ImageView tabFour = (ImageView) LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
    tabFour.setImageResource(R.drawable.ic_more);
    tabLayout.getTabAt(3).setCustomView(tabFour);
}

我想在这里打开tabOne,这段代码在另一个活动中

 if (extras.get("NAME").equals("Post ")) {
       //I want to open tabOne here, when you click here it should open tab one from here
    }

0 个答案:

没有答案
相关问题