Custom is always focused on Tablayout. Tab output is as follows. How to get the full space available to its parent element, i.e. TabView
<android.support.design.widget.TabLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/tablayout" android:layout_width="match_parent" app:tabPaddingStart="0dp" app:tabPaddingEnd="0dp" android:layout_height="90dp"> </android.support.design.widget.TabLayout>
Adding a text image as shown below
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/holo_purple" android:gravity="center_horizontal"> <TextView android:text="Hello !" android:layout_width="match_parent" android:layout_height="match_parent"/> </LinearLayout>
But, unfortunately, he is always focused and never gets full space. The problem is that I cannot provide a separator between the tabs, as it is always in the center.
Java code for adding tabs:
TabLayout v = (TabLayout)findViewById(R.id.tablayout); TabLayout.Tab tab = v.newTab(); tab.setCustomView(R.layout.content_main); v.addTab(tab); tab = v.newTab(); tab.setCustomView(R.layout.content_main); v.addTab(tab); tab = v.newTab(); tab.setCustomView(R.layout.content_main); v.addTab(tab)
I shared the image @ http://i60.tinypic.com/11cdvyf.jpg
source share