Reputation: 553
I had used navigation slider menu code from here -> Android Sliding Menu using Navigation Drawer But when ever i click on sliding menu navigation icon that goes little inside and change the position. I need is that it be constant there should be no movement on Click it on the time the navigation list is open.
Upvotes: 1
Views: 345
Reputation: 39191
The ActionBarDrawerToggle
is what causes that behavior. It does this in methods it implements as a DrawerLayout.DrawerListener
, which we can override, and not call up to the super
methods.
For the ActionBarDrawerToggle
class found in the support-v4
library, we need only override one method:
mDrawerToggle = new ActionBarDrawerToggle(...) {
...
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {
// Do not call super.onDrawerSlide(drawerView, slideOffset);
...
}
};
With the class from appcompat-v7
, we need to override two additional methods:
mDrawerToggle = new ActionBarDrawerToggle(...) {
...
@Override
public void onDrawerSlide(View drawerView, float slideOffset){
// Do not call super.onDrawerSlide(drawerView, slideOffset);
...
}
@Override
public void onDrawerClosed(View drawerView) {
// Do not call super.onDrawerClosed(drawerView);
...
}
@Override
public void onDrawerOpened(View drawerView) {
// Do not call super.onDrawerOpened(drawerView);
...
}
};
Upvotes: 3
Reputation: 869
As per your requirement this is the code to hide fragment,Here lvf is the name assigned to the fragment.
lvf = new ListViewFragment();
Here is the list view sample code
list2.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out);
if (lvf.isHidden()) {
ft.show(lvf);
layout.setVisibility(View.VISIBLE);
} else {
ft.hide(lvf);
layout.setVisibility(View.GONE);
}
ft.commit();
}
});
Upvotes: 0