简体   繁体   中英

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 . (I'm using Support Library, revision 19.0.1)

In this issue, the google's staff said "this is fixed in the Support Library v19". However, it does not work in my device(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 .

Link:

adt-bundle-windows-x86-20130917\\adt-bundle-windows-x86-20130917\\sdk\\extras\\android\\support\\v7\\appcompat

Step 2: Make it a Library.

-Right Click on android-support-v7-appcompat.

-click on properties.

-click on Android(below resource).

-Mark it as "isLibrary".

Step 3: Use it in your project.

-Right Click on your Project.

-click on properties.

-click on Android(below resource).

-click on "Add".

-click on android-support-v7-appcompat to make it your Library for your project.

Step 4: call Action Bar in you Activity.

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.

<resources>

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

</resources>

Step 6: Update your manifest File, add it under "application".

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

ALL THE BEST, revert back if you face any problem.

使用getSupportActionBar().setTitle()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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