I want to obtain a similar tab effect with the button bar of twitter app.
I wish to click on a button and change the view down. I can switch activity but I think It's wrong, or not?
The top bar have to be fix like a frame. Like this:
Ok now I post a part of my idea (i found something similar here: http://www.talkandroid.com/android-forums/android-development-answers-tutorials-code-snippets/1515-how-i-open-image-imagebutton.html)
code:
newsButton = (ImageButton) findViewById(R.id.news);
newsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// on click go to the news view (no activity yet)
setContentView(R.layout.news);
}
});
Like in the Google IO App?
If so, the Source Code is freely available here.
Okay, a little tour on how Google does it:
activity_home.xml
-layout
includes (Line 21) the
actionbar.xml
-layout (This is done
in every Layout so the Actionbar
must not always be duplicated).actionbar.xml
-Layout
creates a LinearLayout
for
the UI-Elements.activity_home.xml
-layout, receives
an ActivityHelper-class and calls
its setupActionBar()
-method.ActivityHelper
-class
is in the hg/ android/ src/ com/
google/ android/ apps/ iosched/
util/
-package and has the
setupActionBar()-method which
creates the Action bar.This might be easier then it looks. Read your way through the Source Code and try it yourself.