12

I'm building an application that should work on android 2.3 and I added both ActionBarSherlock and HoloEverywhere libraries.

In order to use ActionBarSherlock I have to use Theme.Sherlock like so :

<application
    ...
    android:theme="@style/Theme.Sherlock"
    ...  >

And that's ok.

My main activity is pretty simple : just a ListView with 5 rows (I don't use ListAcivity).

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ListView
        android:id="@+id/menuListView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

</LinearLayout>

Since it's android 2.3, I still have the orange&black theme (except for the ActionBar of course). Now I want to add the HoloEverywhere theme by modifying my manifest like so :

<application
    ...
    android:theme="@style/Theme.HoloEverywhereDark.Sherlock"
    ...  >

BUT that does not change anything... What am I missing ?

peetsnack
  • 91
  • 10
Alexis
  • 16,629
  • 17
  • 62
  • 107
  • 2
    i need the spinner like ICS in previous versions. But i tried importing ActionBarSherlock and Holoeverywhere. But in eclipse after importing throwing lot of errors. And also please tell can't we just use holoeverywhere without ActionBarSherlock ? – Vins Sep 12 '12 at 10:29
  • which errors? and yes you can use Holoeverywhere without actionbarsherlock – Alexis Sep 12 '12 at 14:07
  • Like resource not found errors. Step i did to import is->File->New Project->Android Project From Existing code. – Vins Sep 13 '12 at 04:11
  • Check that the R.java file is correctly generated, sometimes it's not. Also you should set ActionBarSherlock project as a library in the properties of HoloEverywhere project. – Alexis Sep 13 '12 at 06:59

3 Answers3

7

To enable the Holo theme by default for every ListView I went in the styles.xml file of the HoloEverywhere library then I modified the "ListViewStyle" element by adding this line :

<item name="android:listSelector">@drawable/list_selector_holo_dark</item>
Alexis
  • 16,629
  • 17
  • 62
  • 107
3

I had the same issue with ListView's selector. I though that HoloEveruwhere would apply holo selector(blue) by default(I have tried both Theme.HoloEverywhereLight and Theme.HoloEverywhereLight), but it didn't. Maybe I am missing something.

I ended up setting the selector manually:

listView.setSelector(R.drawable.list_selector_holo_light);

You have several drawable resources in the library you can make use of(list_selector_holo_light for example).

Iñigo
  • 12,723
  • 2
  • 31
  • 31
2

A portable and correct solution would be to inherit from ListViewStyle and override the attribute, making this in your styles.xml.

If you had HoloEverywhere official library deployed remotely on a server (e.g. Maven repo) you could not depend on it mantaining a change in the styles.xml (you are modifying it for your own needs).

saiyancoder
  • 1,285
  • 2
  • 13
  • 20