java - hide actionBar on Swipe vertical viewPager -
i'm trying hide actionbar/toolbar on swipe using vertical viewpager, mainactivity
xml:
<android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" tools:ignore="inconsistentlayout"> <android.support.design.widget.coordinatorlayout android:id="@+id/coordinator_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:fitssystemwindows="true"> <include android:id="@+id/toolbar" layout="@layout/view_toolbar" /> </android.support.design.widget.appbarlayout> <include layout="@layout/view_home" /> </android.support.design.widget.coordinatorlayout> <include layout="@layout/view_left_drawer" /> </android.support.v4.widget.drawerlayout>
i added toolbar : app:layout_scrollflags="scroll|enteralways"
i have blank page in fragment, viewpager
not visible:
<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.nestedscrollview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:isscrollcontainer="false" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="fill_vertical" android:background="@color/greeen_theme" android:cliptopadding="false" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:background="@color/light_theme_color_read" android:layout_width="match_parent" android:layout_height="match_parent"> <button android:id="@+id/refreshlistbtn" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginbottom="5dp" android:layout_marginleft="10dp" android:layout_marginright="10dp" android:layout_margintop="10dp" android:background="@drawable/bg_refresh_list_button_selector" android:textcolor="@android:color/white" android:visibility="visible"/> <com.axample.android.view.swiperefreshlayout android:id="@+id/swiperefresh" android:layout_width="match_parent" android:layout_height="match_parent"> <com.axample.android.adapter.vertical.verticalviewpager android:id="@+id/viewpager" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/pager_padd_botom" android:cliptopadding="false"/> </com.axample.android.view.swiperefreshlayout> </relativelayout> </android.support.v4.widget.nestedscrollview>
video : https://www.youtube.com/watch?v=swknazfs6ra
please help!!
update : view_left_drawer.xml
<?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/left_drawer" android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="start" android:background="@color/black_main" tools:showin="@layout/activity_home"> <include layout="@layout/view_drawer_content"/> </framelayout>
my swiperefreshlayout
: https://github.com/fredjul/flym/blob/master/flym/src/main/java/net/fred/feedex/view/swiperefreshlayout.java
problem swiperefreshlayout, should on top of nestedscrollview layout.
<android.support.v4.widget.swiperefreshlayout <android.support.v4.widget.nestedscrollview </<android.support.v4.widget.nestedscrollview> </<android.support.v4.widget.swiperefreshlayout>
activity_main.xml
<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" tools:opendrawer="end" tools:ignore="inconsistentlayout"> <include layout="@layout/app_bar_main" android:layout_width="match_parent" android:layout_height="match_parent" /> <android.support.design.widget.navigationview android:id="@+id/nav_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="end" android:fitssystemwindows="true" app:headerlayout="@layout/nav_header_main" app:menu="@menu/activity_main_drawer" /> </android.support.v4.widget.drawerlayout>
app_bar_main.xml
<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.sample.mainactivity" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android"> <android.support.design.widget.appbarlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/apptheme.appbaroverlay" android:layoutdirection="rtl"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="?attr/colorprimary" app:popuptheme="@style/apptheme.popupoverlay" app:layout_scrollflags="scroll|enteralways"/> </android.support.design.widget.appbarlayout> <include layout="@layout/content_main"/> </android.support.design.widget.coordinatorlayout>
content_main.xml
<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.swiperefreshlayout xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/swiperefreshlayout" android:layout_height="match_parent" android:layout_width="match_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <android.support.v4.widget.nestedscrollview android:isscrollcontainer="false" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/colorprimary" android:cliptopadding="false" tools:context=".mainactivity" android:fillviewport="true" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:background="@color/coloraccent" android:layout_width="match_parent" android:layout_height="match_parent"> <button android:id="@+id/refreshlistbtn" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginleft="10dp" android:layout_marginright="10dp" android:layout_margintop="10dp" android:background="@drawable/flat_selector" android:textcolor="@android:color/white" android:visibility="visible"/> <textview android:layout_width="match_parent" android:layout_height="match_parent" android:text="add viewpager instead of textview" android:layout_below="@+id/refreshlistbtn" android:layout_alignparenttop="true" android:layout_alignparentbottom="true" android:textcolor="#ffffff" android:gravity="center"/> </relativelayout> </android.support.v4.widget.nestedscrollview> </android.support.v4.widget.swiperefreshlayout>
Comments
Post a Comment