简体   繁体   English

ActionBar Compat ActionBarActivity setTitle在Android 2.X中不起作用

[英]ActionBar Compat ActionBarActivity setTitle does not work in Android 2.X

My question is same as this issue . 我的问题和这个问题一样

I've setup the Android Support Library by following this instruction . 我按照此说明设置了Android支持库。 (I'm using Support Library, revision 19.0.1) (我正在使用支持库,修订版19.0.1)

In this issue, the google's staff said "this is fixed in the Support Library v19". 在本期中,谷歌的工作人员说“这已在支持库v19中修复”。 However, it does not work in my device(Gingerbread). 但是,它在我的设备(Gingerbread)中不起作用。

I've tried to find solution, but I couldn't find that. 我试图找到解决方案,但我找不到。 Any ideas? 有任何想法吗?

Step 1: Import appcompat from your adt-bundle folder to your eclipse . 第1步:将appcompat从adt-bundle文件夹导入到eclipse中。

Link: 链接:

adt-bundle-windows-x86-20130917\\adt-bundle-windows-x86-20130917\\sdk\\extras\\android\\support\\v7\\appcompat ADT-束 - 窗口x86-20130917 \\ ADT-束 - 窗口x86-20130917 \\ SDK \\演员\\机器人\\ SUPPORT \\ V7 \\程序兼容性

Step 2: Make it a Library. 第2步:使其成为一个库。

-Right Click on android-support-v7-appcompat. -Right点击android-support-v7-appcompat。

-click on properties. - 点击属性。

-click on Android(below resource). 点击Android(资源下方)。

-Mark it as "isLibrary". - 将其标记为“isLibrary”。

Step 3: Use it in your project. 第3步:在项目中使用它。

-Right Click on your Project. - 右键单击​​您的项目。

-click on properties. - 点击属性。

-click on Android(below resource). 点击Android(资源下方)。

-click on "Add". - 点击“添加”。

-click on android-support-v7-appcompat to make it your Library for your project. - 点击android-support-v7-appcompat,使其成为您项目的库。

Step 4: call Action Bar in you Activity. 第4步:在Activity中调用Action Bar。

ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);

Step 5: Make an styles.Xml file in "Values" folder if do not exist and add under mention code. 步骤5:如果不存在则在“Values”文件夹中创建styles.Xml文件,并在提及的代码下添加。

<resources>

<style name="ProgressBarStyle" parent="@android:style/Widget.ProgressBar.Horizontal"/>

</resources>

Step 6: Update your manifest File, add it under "application". 第6步:更新清单文件,将其添加到“应用程序”下。

android:theme="@style/Theme.Base.AppCompat.Light.DarkActionBar" 机器人:主题= “@风格/ Theme.Base.AppCompat.Light.DarkActionBar”

ALL THE BEST, revert back if you face any problem. 一切顺利,如果您遇到任何问题,请退回。

使用getSupportActionBar().setTitle()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM