noties / Scrollable

Android scrollable tabs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

when topView height is changed , tabLayout below will be covered

Fredlxy opened this issue · comments

when topView height is changed , tabLayout below will be covered

Hello @Fredlxy !

Please provide further details:

  • layout XML
  • ScrollableLayout initialization code

There is a textView in top_layout

When I click a button in top_layout , The textView will change its height

Then the tabLayout below the top_layout will be covered

I know the ScrollableLayout extends FrameLayout

But That's not I want

xml:

<com.lianjia.alliance.common.view.scrollLayout.ScrollableLayout
      android:id="@+id/scrollableLayout"
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      link:scrollable_autoMaxScroll="true"
      link:scrollable_autoMaxScrollViewId="@id/top_layout">
      <LinearLayout
        android:id="@+id/top_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        <!-- the textView will change height,when click a button-->
        <TextView
          android:layout_width="match_parent"
          android:layout_height="wrap_content" />
      </LinearLayout>
      <com.lianjia.alliance.common.view.WhiteTabHost
        android:id="@+id/tab_host"
        android:layout_width="match_parent"
        android:paddingLeft="@dimen/padding_20"
        android:paddingRight="@dimen/padding_20"
        android:layout_height="@dimen/material_50dp"
        link:text_selected_color="@color/color_222222"
        link:text_default_color="@color/color_222222"
        link:is_show_indicator="true"
        link:text_size="@dimen/textsize_14"
        link:tab_layout="@layout/tenant_tabhost_item"
        style="@style/Widget.WhiteTabsHost" />

      <android.support.v4.view.ViewPager
        android:id="@+id/recommend_house_view_pager"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
    </com.lianjia.alliance.common.view.scrollLayout.ScrollableLayout>

Code:

mScrollableLayout.setDraggableView(mTabHost) //WhiteTabHost in xml
   mScrollableLayout.apply {
     setCanScrollVerticallyDelegate { direction ->
      val fragment : CustomerDemandRecommendHouseListFragment = mFragments[mCurrentPosition]
       fragment.canScrollVertically(direction)
     }
setOnFlingOverListener { y, duration ->
       val fragment : CustomerDemandRecommendHouseListFragment = mFragments[mCurrentPosition]
         fragment.onFlingOver(y, duration)
     }
   } 

Try changing ViewPager layout_height to match_parent. It's actually a requirement from ScrollableLayout to function

it does not work
I solved this problem using ScroollView + ViewPager+ListView.
thank you

Hm, glad I could help.

Also, in your XML, ScrollableLayout should also have match_parent as layout_height, but as you've already solved it... 👍