ActionBar on the TOP and BOTTOM on Android App

2019-08-25 05:08发布

问题:

I'm developing an Android app and I want to have 2 ActionBar (one on the top and another on the bottom) like this: http://developer.android.com/design/media/action_bar_pattern_considerations.png

I'm using Actionbar Sherlock and for now I created only the top ActionBar. I serched in the web, but I didn't find a solution yet, only some piece of code.

Can anyone help?

回答1:

Take a look at the following links:

http://developer.android.com/guide/topics/ui/actionbar.html

How can I force the Action Bar to be at the bottom in ICS?

Changing position of Android Action Bar



回答2:

try this...

public class MainActivity extends SherlockActivity {

    private View contentView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        contentView = getLayoutInflater().inflate(R.layout.activity_main, null);
        setContentView(contentView);
        LinearLayout layout = (LinearLayout) contentView.getParent().getParent();
        View view = layout.getChildAt(0);
        layout.removeViewAt(0);
        layout.addView(view);
    }