android - Hide only the Action bar on Scroll not action bar tabs -
i getting issue @ trying hide action bar while scrolling down.then while scrolling up,the action bar have shown again.
for eg:
i referred tutorial.here can see output , respective codes related hide , show action bar.
i showing output till now.
after scrolling down:
the screenshot above shown, hide action bar tab also.but have hide action bar.that's major issue.
after scrolling up:
the screenshot above shows displays action bar tabs.
topratedfragment.java:
import info.androidhive.tabsswipe.r; import android.app.actionbar; import android.content.res.typedarray; import android.os.bundle; import android.support.v4.app.fragment; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.view.viewtreeobserver; import android.view.window; import android.widget.scrollview; public class topratedfragment extends fragment implements viewtreeobserver.onscrollchangedlistener { private float mactionbarheight; private actionbar actionbar; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.fragment_top_rated, container, false); final typedarray styledattributes = getactivity().gettheme().obtainstyledattributes( new int[] { android.r.attr.actionbarsize }); mactionbarheight = styledattributes.getdimension(0, 0); styledattributes.recycle(); actionbar = getactivity().getactionbar(); ((scrollview)rootview.findviewbyid(r.id.parent)).getviewtreeobserver().addonscrollchangedlistener(this); return rootview; } @override public void onscrollchanged() { float y = ((scrollview)getactivity().findviewbyid(r.id.parent)).getscrolly(); if (y >= mactionbarheight && actionbar.isshowing()) { actionbar.hide(); } else if ( y==0 && !actionbar.isshowing()) { actionbar.show(); } } }
fragment_top_rated.xml:
<?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/parent" android:layout_width="fill_parent" android:layout_height="fill_parent" > <linearlayout android:id="@+id/linearlayout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingtop="?android:attr/actionbarsize" android:orientation="vertical" > <button android:id="@+id/button1" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="button" /> <button android:id="@+id/button5" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="button" /> . . </linearlayout> </scrollview>
my issue is, while scrolling down have hide action bar not action bar tabs.
i think this library , sample you.
look @ top-right gif animation:
i think sample file called "viewpagertabscrollviewactivity"
Agreed with your point. Also, The Statista Digital Market Outlook estimates that the global market revenue of mobile applications in diverse segments is expected to advance in the next several years and is forecast to reach $613 billion by 2025. Such statistics make mobile app developers one of the
ReplyDeletemost demanded specialists on the market.
Hire a top-rated freelance app developer on the emerging freelance marketplace Eiliana.com and get high-quality deliverables on time.
Wow, great blog. I loved how you talked about the importance of freelance developers, and getting java jobs is quite tough. I knew about Eiliana.com. It is one of the emerging freelance platforms you can look for projects there.
ReplyDelete