newbie_android_dev
newbie_android_dev

Reputation: 11

How to add margin between tab backgrounds inside tab layout android?

2 tabs having separate backgrounds with border and there should be distance between those to backgrounds.

Upvotes: 0

Views: 385

Answers (2)

redoc
redoc

Reputation: 2469

Welcome, Keeping views like this(that tick) on top of another view is called Overlapping Layouts, you can do it by using relative layout, the gallery view and image view will overlap

<RelativeLayout 
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/gallerylayout"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
  <Gallery
    android:id="@+id/overview"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
  />
  <ImageView
    android:id="@+id/navigmaske"
    android:background="#0000" /*use #000000 for black colour*/
    android:src="@drawable/navigmask" //put your image here
    android:scaleType="fitXY"
    android:layout_alignTop="@id/overview"
    android:layout_alignBottom="@id/overview"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
  />
</RelativeLayout>

Reference post

Upvotes: 0

Ameen Essa
Ameen Essa

Reputation: 124

You can add those two attributes:

<android.support.design.widget.TabLayout
...
app:tabPaddingStart="10dp" 
app:tabPaddingEnd="10dp" />

I found the same question before and you can find the answer there: https://stackoverflow.com/a/36511524/9040853

I hope you find my answer is useful.

Upvotes: 1

Related Questions