private void changeTabTitleColors(int position) { ((TextView) ((ViewGroup) tabCategories.getChildAt(0)).getChildAt(0)) .setTextColor(getResources().getColor(R.color.secondary_text)); ((TextView) ((ViewGroup) tabCategories.getChildAt(0)).getChildAt(1)) .setTextColor(getResources().getColor(R.color.secondary_text)); if (tabCount == 3) { ((TextView) ((ViewGroup) tabCategories.getChildAt(0)).getChildAt(2)) .setTextColor(getResources().getColor(R.color.secondary_text)); } ((TextView) ((ViewGroup) tabCategories.getChildAt(0)).getChildAt(position)) .setTextColor(getResources().getColor(R.color.primary_text)); }
// region Lifecycle Methods @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_quick_return_twitter); ButterKnife.inject(this); mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager.setAdapter(mSectionsPagerAdapter); mTabs.setAllCaps(false); mTabs.setShouldExpand(true); mTabs.setTextSize(QuickReturnUtils.dp2px(this, 16)); mTabs.setTabBackground(R.drawable.selector_bg_tab); mTabs.setIndicatorColorResource(R.color.steel_blue); mTabs.setIndicatorHeight(QuickReturnUtils.dp2px(this, 5)); mTabs.setOnPageChangeListener(mTabsOnPageChangeListener); mTabs.setViewPager(mViewPager); // Set first tab selected mTabsLinearLayout = ((LinearLayout) mTabs.getChildAt(0)); for (int i = 0; i < mTabsLinearLayout.getChildCount(); i++) { TextView tv = (TextView) mTabsLinearLayout.getChildAt(i); if (i == 0) { tv.setTextColor(getResources().getColor(R.color.steel_blue)); tv.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/Roboto-Medium.ttf")); } else { tv.setTextColor(getResources().getColor(R.color.steel_blue)); tv.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/Roboto-Light.ttf")); } } }
// region Lifecycle Methods @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_quick_return_facebook); ButterKnife.inject(this); mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager.setAdapter(mSectionsPagerAdapter); mTabs.setAllCaps(false); mTabs.setShouldExpand(true); // mTabs.setTextSize(QuickReturnUtils.dp2px(this, 16)); // mTabs.setTabBackground(R.drawable.selector_bg_tab); mTabs.setIndicatorColorResource(R.color.steel_blue); mTabs.setIndicatorHeight(QuickReturnUtils.dp2px(this, 5)); mTabs.setDividerColor(getResources().getColor(android.R.color.transparent)); // mTabs.setBackgroundColor(getResources().getColor(R.color.indigo)); mTabs.setOnPageChangeListener(mTabsOnPageChangeListener); mTabs.setViewPager(mViewPager); // Set first tab selected mTabsLinearLayout = ((LinearLayout) mTabs.getChildAt(0)); ImageButton ib = (ImageButton) mTabsLinearLayout.getChildAt(0); ib.setImageResource(R.drawable.ic_action_event_highlighted); }
private void changeTabsFont() { ViewGroup vg = (ViewGroup) tabCategories.getChildAt(0); int tabsCount = vg.getChildCount(); for (int j = 0; j < tabsCount; j++) { TextView textView = (TextView) vg.getChildAt(j); textView.setWidth(App.screenWidth / tabCount); // textView.setTypeface(App.englishFont); textView.setTextColor(getResources().getColor(R.color.secondary_text)); textView.setTextSize(14); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_friends); This = this; Log.d(TAG, "Info oncreate"); ButterKnife.bind(this); parseUser = ParseUser.getCurrentUser(); alertD = new Alert(this); isLoadData = false; final ViewPager vpPager = (ViewPager) findViewById(R.id.vpPager); adapterViewPager = new MyPagerAdapter(getSupportFragmentManager()); vpPager.setAdapter(adapterViewPager); // Check data extra Intent intent = getIntent(); Bundle extras = intent.getExtras(); if (extras != null) { String jsonData = extras.getString("com.parse.Data"); JSONObject json = null; try { json = new JSONObject(jsonData); String action = json.getString("action"); switch (action) { case "friends_invite": vpPager.setCurrentItem(2); break; case "friends_search": vpPager.setCurrentItem(1); break; default: vpPager.setCurrentItem(0); } } catch (JSONException e) { e.printStackTrace(); } } PagerSlidingTabStrip tabsStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs); LinearLayout view = (LinearLayout) tabsStrip.getChildAt(0); tabsStrip.setViewPager(vpPager); loadData(); }