Android, simple Activity templates
Lets assume that you need Activity with bottom menu present at all sreens ( iPhone style ). Create BottomMenuActivity class, descendant of Activity class. Override onCreate:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setContentView(R.layout.a_bottommenu);
// ... do the rest ...
}
Then you may simply override setContentView method, so it will look like this:
@Override
public void setContentView( int layoutResID ){
// container is a part of a_bottommenu.xml layout
FrameLayout container = (FrameLayout)
findViewById( R.id.containerBottomMenu );
getLayoutInflater().inflate( layoutResID, container, true );
}
Now you may subclass BottomMenuActivity and when you will call setContentView you will fill free space inside a_bottommenu.xml
Written by Iwo Polański
Related protips
1 Response
@kubamor It would be nice to comment in english. May I ask how is this related to tip ?
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Android
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#