Yarh
Yarh

Reputation: 4607

How to pass onClick from view pager to view below it?

I have view pager above tablayout, as some pages have to hide tablayout, but now I cannot click on my tabs.

  <android.support.design.widget.TabLayout
      android:id="@+id/tab_layout"
      android:layout_width="match_parent"
      android:layout_height="50dip"
      android:layout_alignParentBottom="true"
      app:tabBackground="@drawable/bg_tab"
      app:tabGravity="fill"
      app:tabIndicatorColor="@null"
      app:tabIndicatorHeight="0dip"
      app:tabMinWidth="0dip"
      app:tabMode="fixed"
      app:tabSelectedTextColor="@color/white"
      app:tabTextAppearance="@style/MineCustomTabText"
      app:tabTextColor="@color/white"
      />
  <android.support.v4.view.ViewPager
      android:id="@+id/view_pager"
      android:layout_width="match_parent"
      android:layout_height="match_parent"

      />

</RelativeLayout>

Upvotes: 1

Views: 112

Answers (1)

Janki Gadhiya
Janki Gadhiya

Reputation: 4510

I suggest you to use yourView.bringToFront().

bringToFront

Change the view's z order in the tree, so it's on top of other sibling views. This ordering change may affect layout, if the parent container uses an order-dependent layout scheme (e.g., LinearLayout). Prior to KITKAT this method should be followed by calls to requestLayout() and invalidate() on the view's parent to force the parent to redraw with the new child ordering.

Upvotes: 1

Related Questions