sara.nikzadeh
شنبه 18 بهمن 1393, 20:03 عصر
با سلام خدمت اساتید محترم
من تو پروژه ام از یه اکشن بار استفاده کردم. همه چیز عالی کار میکنه. فقط دو سه تا چیز هست که نتوستم کاریشون کنم.
اول اینکه میخوام تو اکشن بار، اسم پروژه نباشه.
دوم اینکه این کد ها رو به اکتیویتی هام که اضافه کردم عمل Navigation انجام نمیشه
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.next_activity);
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
private boolean MenuChoice(MenuItem item)
{
switch (item.getItemId()) {
case android.R.id.home:
Toast.makeText (this,"You clicked on the Application icon",Toast.LENGTH_LONG).show();
Intent i = new Intent(this, MainActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
//Toast.makeText (this,"You clicked on the Application icon",Toast.LENGTH_LONG).show();
return true;
case 0:
Toast.makeText (this, "You clicked on Item 1",Toast.LENGTH_LONG).show();
return true;
case 1:
//...
}
return false;
}
سوم اینکه چطوری می تونم رنگ فونت و نوع فونت دلخواهم رو اعمال کنم.
چهارم اینکه تا روی باتنی که در اکشن بار هست کلیک می کنم، به Main Activity نمیره و هیچ اتفاق خاصی رخ نمی ده
ممنون از همه دوستان
من تو پروژه ام از یه اکشن بار استفاده کردم. همه چیز عالی کار میکنه. فقط دو سه تا چیز هست که نتوستم کاریشون کنم.
اول اینکه میخوام تو اکشن بار، اسم پروژه نباشه.
دوم اینکه این کد ها رو به اکتیویتی هام که اضافه کردم عمل Navigation انجام نمیشه
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.next_activity);
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
private boolean MenuChoice(MenuItem item)
{
switch (item.getItemId()) {
case android.R.id.home:
Toast.makeText (this,"You clicked on the Application icon",Toast.LENGTH_LONG).show();
Intent i = new Intent(this, MainActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
//Toast.makeText (this,"You clicked on the Application icon",Toast.LENGTH_LONG).show();
return true;
case 0:
Toast.makeText (this, "You clicked on Item 1",Toast.LENGTH_LONG).show();
return true;
case 1:
//...
}
return false;
}
سوم اینکه چطوری می تونم رنگ فونت و نوع فونت دلخواهم رو اعمال کنم.
چهارم اینکه تا روی باتنی که در اکشن بار هست کلیک می کنم، به Main Activity نمیره و هیچ اتفاق خاصی رخ نمی ده
ممنون از همه دوستان