http://www.slideshare.net/androidstream/action-bar-sherlock-tutorial
https://www.youtube.com/watch?v=FKd1yVpIXHo
http://actionbarsherlock.com/usage.html
android:theme="@style/Theme.Sherlock">
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.app.ActionBar;
and
public class MainActivity extends SherlockActivity {
ActionBar ab ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ab = getSupportActionBar();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
MenuInflater mf = getSupportMenuInflater();
mf.inflate(R.menu.activity_main, menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId())
{
case R.id.menu_settings:
startActivity(new Intent(this, pageu.class));
return true;
case R.id.menu_home:
return true;
case R.id.menu_about:
startActivity(new Intent(this, pageu.class));
return true;
default:
return super.onOptionsItemSelected(item);
}
}
xml
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/menu_settings"
android:orderInCategory="100"
android:title="@string/menu_settings"
android:showAsAction="ifRoom"/>
<item
android:id="@+id/menu_home"
android:orderInCategory="100"
android:title="home"
android:showAsAction="ifRoom">
<menu >
<item android:id="@+id/menu_about"
android:title="about"/>
<item android:id="@+id/menu_coming"
android:title="acomin"/>
</menu>
</item>
</menu>
https://www.youtube.com/watch?v=FKd1yVpIXHo
http://actionbarsherlock.com/usage.html
android:theme="@style/Theme.Sherlock">
java
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.app.ActionBar;
and
public class MainActivity extends SherlockActivity {
ActionBar ab ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ab = getSupportActionBar();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
MenuInflater mf = getSupportMenuInflater();
mf.inflate(R.menu.activity_main, menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId())
{
case R.id.menu_settings:
startActivity(new Intent(this, pageu.class));
return true;
case R.id.menu_home:
return true;
case R.id.menu_about:
startActivity(new Intent(this, pageu.class));
return true;
default:
return super.onOptionsItemSelected(item);
}
}
xml
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/menu_settings"
android:orderInCategory="100"
android:title="@string/menu_settings"
android:showAsAction="ifRoom"/>
<item
android:id="@+id/menu_home"
android:orderInCategory="100"
android:title="home"
android:showAsAction="ifRoom">
<menu >
<item android:id="@+id/menu_about"
android:title="about"/>
<item android:id="@+id/menu_coming"
android:title="acomin"/>
</menu>
</item>
</menu>
No comments:
Post a Comment