Hi, I have a problem applying a custom theme to a ListView.
It works fine if I do it explicitly by assigning the style to the
Listview in the layout file. It doesn't work if I assign the style
globally to the application in my AndroidManifest.xml file.
1.) Ok, here's what works fine:
I created a new theme .. My styles.xml looks like this:
------------------------------------------------
<resources>
<!-- Base application theme is the default theme. -->
<style name="MyOwnTheme" parent="android:Theme">
<item name="android:listSelector">@drawable/
list_selector_background</item>
</style>
</resources>
------------------------------------------------
@drawable/list_selector_background points to an xml file that
describes my own selector which uses my own PNG images to display the
different selection states. I am sure that the selector works fine.
If I assign this theme explicitly to the ListView in my layout xml
file, it works: The Listview selection background is displayed with my
own PNGs as defined in list_selector_background.xml in my res/
drawables directory. .. For this, the ListView-Node in my layout file
looks like this:
------------------------------------------------
<ListView android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:drawSelectorOnTop="false"
android:layout_marginTop="15px"
style="@style/MyOwnTheme"
/>
------------------------------------------------
2.) what I want to do ideally, is to have all Views in my Application
use my theme by setting it in my AndroidManifest.xml file.
But, if I remove the "style" - attribute from the ListView node and
put an attribute into the <application> node in the manifest file, it
has no effect at all :
AndroidManifest.xml :
------------------------------------------------
...
<application android:icon="@drawable/myicon"
android:label="@string/app_name"
android:theme="@style/MyOwnTheme"
>
...
I expected this to apply MyOwnTheme to the whole application, but that
doesn't seem to happen...
Am I missing something here?
Any help appreciated...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---