mercredi 11 mars 2015

Working with android actionbar


Vote count:

0




I have a code for making a slide menu navdrawer in android, which is provided as a slide.jar i downloaded from somewhere in internet and it is working fine. when i click the icon in action bar, the drawer slides well. The problem is that, i dont want my action bar to slide, but the left menu drawer only should slide, below the action bar.


and also, sliding is possible when i click the icon, but how to make the icon and title i.e. "ashwin" as in image as a slingle clickable item as in gmail's app. my code is:



@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public class MainActivity extends Activity {

SimpleSideDrawer slide_me;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);


ActionBar a= getActionBar();
a.setTitle("ashwin");
a.setIcon(R.drawable.ic_home);
a.setHomeButtonEnabled(true);


slide_me = new SimpleSideDrawer(this);
slide_me.setLeftBehindContentView(R.layout.left_menu);

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
slide_me.toggleLeftDrawer();
break;
default:
return super.onOptionsItemSelected(item);
}
return true;
}


}


Thankyou in advance



asked 45 secs ago







Working with android actionbar

Aucun commentaire:

Enregistrer un commentaire