您可以在此链接中查看
http://forums.xamarin.com/discussion/8771/how-do-i-add-an-actionbar-to-the-bottom
Two action bars (Bottom and Up) at the same time?
在底部添加一个 ActionBar 并在其中放置搜索栏
<LinearLayout>
<RelativeLayout>
... (Top bar content can go here)
</RelativeLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<!--This is assuming you are going to use a listview, you can put anything here, just make sure to put the weight attribute into whatever you end up using-->
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:cacheColorHint="@color/black"
android:layout_weight="1" />
<!--Bottom bar layout below-->
<LinearLayout
android:orientation="horizontal"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/linearLayout2"
android:layout_weight="0" >
...Put your bottom bar content here...
</LinearLayout>
</LinearLayout>
</LinearLayout>
http://developer.android.com/guide/topics/ui/actionbar.html
添加操作栏
如上所述,本指南重点介绍如何使用支持库中的 ActionBar API。因此,在添加操作栏之前,您必须按照支持库设置中的说明使用 appcompat v7 支持库设置您的项目。
使用支持库设置项目后,以下是添加操作栏的方法:
通过扩展 ActionBarActivity 创建您的活动。
为您的活动使用(或扩展)其中一个 Theme.AppCompat 主题。例如:
<activity android:theme="@style/Theme.AppCompat.Light" ... >
添加操作项
res/menu/main_activity_actions.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/action_search"
android:icon="@drawable/ic_action_search"
android:title="@string/action_search"/>
<item android:id="@+id/action_compose"
android:icon="@drawable/ic_action_compose"
android:title="@string/action_compose" />
</menu>
然后在您的活动的 onCreateOptionsMenu() 方法中,将菜单资源膨胀到给定的菜单中以将每个项目添加到操作栏:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu items for use in the action bar
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_activity_actions, menu);
return super.onCreateOptionsMenu(menu);
}
要请求将项目作为操作按钮直接显示在操作栏中,请在标记中包含 showAsAction="ifRoom"。例如:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:yourapp="http://schemas.android.com/apk/res-auto" >
<item android:id="@+id/action_search"
android:icon="@drawable/ic_action_search"
android:title="@string/action_search"
yourapp:showAsAction="ifRoom" />
...
</menu>
如果操作栏中的项目没有足够的空间,它将出现在操作溢出中。
使用支持库中的 XML 属性
请注意,上面的 showAsAction 属性使用标签中定义的自定义命名空间。这在使用支持库定义的任何 XML 属性时是必需的,因为这些属性在旧设备上的 Android 框架中不存在。因此,您必须使用自己的命名空间作为支持库定义的所有属性的前缀。
如果您的菜单项同时提供标题和图标(带有标题和图标属性),则默认情况下操作项仅显示图标。如果要显示文本标题,请将“withText”添加到 showAsAction 属性。例如:
<item yourapp:showAsAction="ifRoom|withText" ... />