Professional Documents
Culture Documents
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/hideBt"
android:text="Hide The Action Bar"></Button>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/showBt"
android:text="Show The Action Bar"></Button>
</LinearLayout>
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.optionsmenu, menu);
return true;
}
}
(c) 2010 Haim Michael. All Rights Reserv
ed.
Adding Action Items
optionsmenu.xml
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.optionsmenu, menu);
return true;
}
}
@Override
protected void onStart()
{
super.onStart();
ActionBar actionBar = this.getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.optionsmenu, menu);
return true;
}
}
</menu>
@Override
protected void onStart()
{
super.onStart();
ActionBar actionBar = this.getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.optionsmenu, menu);
return true;
}
}
@Override
public void onTabReselected(Tab tab, FragmentTransaction ft)
{
//...
}
}
<LinearLayout android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/fragment_place"></LinearLayout>
</LinearLayout>