0

I found this great answer for creating custom action bars:

Android Split Action Bar with Action Items on the top and bottom?

I'm a bit confused on how they formed the bottom bar with the following code:

@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.browser_main, menu);
RelativeLayout relativeLayout = (RelativeLayout) menu.findItem(
        R.id.layout_item).getActionView();

View inflatedView = getLayoutInflater().inflate(
        R.layout.media_bottombar, null);

relativeLayout.addView(inflatedView);

return true;

}

So the browser_main is a menu with a list of items? I'm not sure how the RelativeLayout comes into play. I would like to implement my own RelativeLayout to the bottom bar but I'm not sure how it works. What would be included in the browser_main.xml and media_bottombar.xml. Also, what is the R.id.layout_item?

4

1 回答 1

0

R.id.layout_item 是名为“layout_item.xml”的 xml 布局文件,位于 res/layout/ 下。

如果我是,我会禁用顶部栏和底部栏。然后您可以使用嵌套布局来模拟顶部和底部栏。这要容易得多。但不是最好的解决方案...

于 2013-06-27T20:38:33.227 回答