ActionBar on the TOP and BOTTOM on Android App

2019-08-25 04:53发布

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?

2条回答
我命由我不由天
3楼-- · 2019-08-25 05:34

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);
    }
查看更多
登录 后发表回答