• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Get smooth tab Transition with viewpager.

Kiwi_gamer01

Lurker
Oct 30, 2021
1
0
Hey, is there a way to get a better visually looking transition method when changing tabs, than mine. I'am using the onChangeTab with viewPager.

Java:
private void onChangeTab(int position) {

       //TextView tab_home = findViewById(R.id.tab_home);

       if(position==0)
       {
           reset();
           TextView tv = findViewById(R.id.tab_home);
           tv.setLayoutParams(new TableLayout.LayoutParams(ViewPager.LayoutParams.WRAP_CONTENT, 40, 0.9f));
           home_.setTextSize(20);
           home_.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.tab_on));
           home_.setBackground(ContextCompat.getDrawable(getApplicationContext(), R.drawable.rounded_selected));
       }
       if(position==1)
       {
   ...



Is There a way to get a smooth transition.
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones