Learning Android ActionBar
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.
------------------------
最新文章
- jQuery中10个非常有用的遍历函数
- 【译】用jQuery 处理XML--浏览器中的XML与JavaScript
- Windows 常用 CMD 命令行介绍
- DataInputStream类和RandomAccessFile类的使用方法
- C语言中宏定义(#define)时do{}while(0)的价值
- APUE习题5.x
- wireshark不仅仅是用来抓包分析网络的;
- Java之循环输出等腰三角形
- 面试题:Java静态/非静态方法重写
- cookie读取、写入、删除
- P3370 【模板】字符串哈希
- 『TensorFlow』网络操作API_上
- AssetBundle打包详解
- Java虚拟机(JVM)概述
- HTML 学习笔记一
- Maven自动化部署
- 【Codeforces】CF 911 D. Inversion Counting(逆序对+思维)
- 获取本地IP地址的vc代码
- tomcat 热部署、热加载 精析
- 怎么实现Linux下的逆波兰计算器dc?
热门文章
- openfire Android学习(三)----会议室创建、加入以及查询会议室中所有成员等
- WMS8_基本操作
- who命令
- 关于global和$GLOBALS[]的一道经典面试题
- node JS 微信开发
- .Net Core表单验证
- MongoDB资料汇总专题(转)
- eclipse的debug使用(转载)
- WPF 后台Render线程崩溃, Exception from HRESULT: 0x88980406
- 【转】IDA远程调试 The debugger could not attach to the selected process. irs_recv 等待的操作过时