I need to left align of the tab text inside tab layout.
<com.google.android.material.tabs.TabLayout
android:id="@ id/tabs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/holo_green_dark"
auto:tabMode="scrollable" />
CodePudding user response:
You can either inflate a custom view in the tab layout as shown here
or you can run a for loop over all tab items and set the gravity of indivisual textview inside the tab layout like this
for (int i = 0; i < tabLayout.getTabCount(); i ) {
TabLayout.Tab tab = tabLayout.getTabAt(i);
tab.view.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
}
CodePudding user response:
Check this
app:tabGravity="start"