skip to Main Content

I can’t add TabLayout because it removes everything that is on design tab and it won’t even show up in Component Tree.

(https://i.stack.imgur.com/ncd27.png)

Tried to Repair IDE but that doesn’t work.
Issue panel only shows that there are missing constrains, that’s not what I need I think.

2

Answers


  1. Chosen as BEST ANSWER

    Problem solved after updating Android Studio


  2. If your parent layout is ConstraintLayout, then you need to set at least one horizontal or vertical constraint for your tablayout.

    for example)

    <com.google.android.material.tabs.TabLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">
    
        <com.google.android.material.tabs.TabItem
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            />
        <com.google.android.material.tabs.TabItem
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            />
        <com.google.android.material.tabs.TabItem
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            />
        <com.google.android.material.tabs.TabItem
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            />
    </com.google.android.material.tabs.TabLayout>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search