Uday
Uday

Reputation: 1699

How to make ActionBar Compatibility with 2.3.3 version?

well my program runs perfectly on 4.0 & above version,

i'm using ActionBarShrelock Library to do this .

when i changed the target to 2.3.3 target=android-10

it's giving error at "R.id.home".

switch (item.getItemId()) 
    {
        case android.R.id.home:
        Log.d("home","home selected");
        slidemenu.show();
        return true;
    }

even i have changed the style to :

<style name="AppTheme" parent="Theme.Sherlock.Light.DarkActionBar"/>

but if i change the target usage : <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />

it works in 2.3 as well as in 4.0 and above ,but the problem is the visuality differs.

output of 4.0 is as shown below.

enter image description here

output of 2.3.3 is as shown below. enter image description here

Any idea how to fix this issue.?

Upvotes: 0

Views: 5173

Answers (4)

Ronak Mehta
Ronak Mehta

Reputation: 5979

it's giving error at "R.id.home".

it seems like there may be problem with imports , will you check your imports

Following import is for ActionBar

 com.actionbarsherlock.app.ActionBar

Following import is for Menu

 com.actionbarsherlock.view.Menu
 com.actionbarsherlock.view.MenuItem
 com.actionbarsherlock.view.MenuInflater

Upvotes: 0

Basim Sherif
Basim Sherif

Reputation: 5440

You could try setting the theme in manifest as android:theme="@style/Theme.Sherlock"

Upvotes: 0

Alexander
Alexander

Reputation: 48232

In your manifest put targetSdk="17" (anyway, put the highest possible) and minSdk="8"

Actually, copy those values from any ABS examples which come with Sherlock.

Upvotes: 1

Swayam
Swayam

Reputation: 16354

ActionBar requires a higher API level and that is why it is not working on 2.3.3.

ActionBar was introduced in API level 11, i.e. Android 3.0.

To use ActionBar in API levels lower than that, you can use ActionBarSherlock.

Upvotes: 5

Related Questions