Android TabLayout: distribute evenly

I’m looking at the Google class that was used in the Google IO called SlidingTabLayout. Inside that class, there is a method called setDistributeEvenly which allows all those tabs to have an even distribution on the screen – every tab has the same size: Align-Center SlidingTabLayout

I’m trying to do the same with the official tabLayout class:

  • What's the convention for java package names without a domain association?
  • Fragment Recursive entry to executePendingTransactions Error
  • Android lifecycle: Fill in data in activity in onStart() or onResume()?
  • creating persistent search bar in android
  • Android: How to change the default logging level?
  • Accessing Android NotificationListenerService Settings
  • But there doesn’t seem to be a method available to make all the tabs evenly distributed.

    Am I missing something and is there a method within the class which will let me do this?

    Related posts:

    java.lang.NoSuchMethodError when use getFragmentManager() with actionbarsherlock library
    string.xml Multiple substitutions specified if using % follow by string two times
    EditText line spacing increase issue and cursor position w.r.t line
    Left align text inside a button in Android
    Is there a way to get a list of all classes from a .dex file?
    Android Actionbar navigation spinner text color
  • Need get Time in a 24 hour format while adding Time
  • ListView does not update when calling notifyDataSetChanged from a BaseAdapter
  • Android Studio 1.0 'runProguard' vs 'minifyEnabled'
  • Android OpenGL ES 2.0 emulator
  • Generate Javadoc error Android Studio
  • How to override filter in android's ArrayAdapter?
  • One Solution collect form web for “Android TabLayout: distribute evenly”

    I read this tutorial to get my answer:

    You are suppose to set the tabLayout gravity:


    And do not set your tabLayout to scrollable (app:tabMode="scrollable") otherwise the gravity fill will not work.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.