zoukankan      html  css  js  c++  java
  • 学习android文档 -- Adding the Action Bar

    1. Setting Up the Action Bar:users-sdk version 11以上可以使用holo主题;如果不使用holo主题,或者sdk版本较低,则需要在manifest文件的<application>和<activity>中加入android:theme = "@style/Theme.xxx"

    2. 添加action buttons:

    1) 首先要在res/menu/下添加一个xml文档。接着内容如下

    <menu xmlns:android="http://schemas.android.com/apk/res/android" >     
    <!-- Search, should appear as action button -->
    <item android:id="@+id/action_search"
    android:icon
    ="@drawable/ic_action_search" 这里只能放bitmap图片,图片位置是res/drawable/ic_action_search.png
    android:title
    ="@string/action_search" 这个是res/value/strings.xml里需要定义的内容
    android:showAsAction
    ="ifRoom" 在sdk低于2.1时,这里的android需要改成自定义的app名称;同时第一句xmlns:android。。。改成xmlns:yourapp=“http://schemas.android.com/apk/res-auto”
    />
    <!-- Settings, should always be in the overflow -->
    <item android:id="@+id/action_settings"
    android:title
    ="@string/action_settings"
    android:showAsAction
    ="never"
    />
    </menu>

    2) 讲这个action添加到action bar里:在当前Activity.java中使用onCreateOptionMenu()将menu标签定义的内容添加进去

    3)答复action buttons

  • 相关阅读:
    bzoj2751
    bzoj1483
    bzoj1011
    bzoj1412
    bzoj1820
    bzoj1295
    bzoj3444
    Java--Exchanger用于进行线程间的数据交换
    Java--Semaphore控制并发线程数量
    Java--Spring AOP 源码散点记录(最后整理成一篇博客)
  • 原文地址:https://www.cnblogs.com/ianthe/p/3678607.html
Copyright © 2011-2022 走看看