PART1:Make Android2.1 Support ActionBar

Last evening I learnt how to make android2.1 support actionbar from Android Developers.The page is HERE,Click.

To sum up , I briefy illustrate the main steps:

1.Add the  v7 appcompat library , which is not just a jar file but a library with resources.

2.Let the Activities that originally extending "Activity" to extend "ActionBarActivity".

3.In your manifest file, update either the <application> element or individual <activity> elements to use one of the Theme.AppCompat themes. For example:

That's it.

BTW,if you wanna know what the Theme.AppCompat themes contain, "Alt + /" is not capable , you can find them also on Android Developers,

Thme.AppCompat.For example, you find

public static int Theme_AppCompat_Light_DarkActionBar,

then you should change the theme like this:

android:theme="@style/Theme.AppCompat.Light.DarkActionBar"

keep in mind that the first letter in each word should be its upper class form.

PART2:Adding Action Buttons

Android Developers says the most important buttons should be set on the ActionBar, buttons that are not so important should be placed in the Overflow Button.

------Met a Problem----

After adding a key-value pair in strings.xml file, MainActivity.java pointed out that R.java can't be found.So open "gen" folder,sure enough R.java is missing.Checking the xml file,I found in <string name="action_search">Search!!</string>, the "s" in the string was written as a upper class form.change it back to lower, R.java returned.Problem solved.

------------------------

最新文章

  1. jQuery中10个非常有用的遍历函数
  2. 【译】用jQuery 处理XML--浏览器中的XML与JavaScript
  3. Windows 常用 CMD 命令行介绍
  4. DataInputStream类和RandomAccessFile类的使用方法
  5. C语言中宏定义(#define)时do{}while(0)的价值
  6. APUE习题5.x
  7. wireshark不仅仅是用来抓包分析网络的;
  8. Java之循环输出等腰三角形
  9. 面试题:Java静态/非静态方法重写
  10. cookie读取、写入、删除
  11. P3370 【模板】字符串哈希
  12. 『TensorFlow』网络操作API_上
  13. AssetBundle打包详解
  14. Java虚拟机(JVM)概述
  15. HTML 学习笔记一
  16. Maven自动化部署
  17. 【Codeforces】CF 911 D. Inversion Counting(逆序对+思维)
  18. 获取本地IP地址的vc代码
  19. tomcat 热部署、热加载 精析
  20. 怎么实现Linux下的逆波兰计算器dc?

热门文章

  1. openfire Android学习(三)----会议室创建、加入以及查询会议室中所有成员等
  2. WMS8_基本操作
  3. who命令
  4. 关于global和$GLOBALS[]的一道经典面试题
  5. node JS 微信开发
  6. .Net Core表单验证
  7. MongoDB资料汇总专题(转)
  8. eclipse的debug使用(转载)
  9. WPF 后台Render线程崩溃, Exception from HRESULT: 0x88980406
  10. 【转】IDA远程调试 The debugger could not attach to the selected process. irs_recv 等待的操作过时