zoukankan      html  css  js  c++  java
  • 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.

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

  • 相关阅读:
    Consul 简介及集群安装
    poj 1300 Door Man 欧拉回路
    Codeforces Round #284 (Div. 2)
    bnuoj 34985 Elegant String DP+矩阵快速幂
    cf 496B Secret Combination
    hdu 5120 Intersection
    poj 2002 Squares
    Codeforces Round #281 (Div. 2)
    转载:百度原CTO李一男经典语录
    hdu 4005 The war
  • 原文地址:https://www.cnblogs.com/larrylawrence/p/3649741.html
Copyright © 2011-2022 走看看