Android action bar with two stretched buttons

前端 未结 5 1852
清酒与你
清酒与你 2020-12-04 20:04

Does anybody know how to easily implement an action bar with two stretched buttons?

Here is an example of the Google calendar app:

5条回答
  •  再見小時候
    2020-12-04 20:52

    Make a horizontal LinearLayout with two buttons. Then set each of their widths to match_parent and android:layout_weight="0.5" (Each button will then take up 50% of the space).

    EDIT:

    To apply as the ActionBar background:

    (ActionBarSherlock) getSupportActionBar().setCustomView(R.layout.my_view);
    (ActionBar) getActionBar().setCustomView(R.layout.my_view);
    

提交回复
热议问题