1

I want to change the title bar color .Following the instructions here , or eliminating the title bar with Notitle bar in AndroidManifest esults in not showing the text fonts in the list view (I use "simple_list_item_checked" listview).

Here is the xml for this activity:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:background="#FFFAFA"
     >
<Button
    android:id="@+id/btn"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/green_button"
    android:text="@string/show_items_kfc"
    android:onClick="onClick"/>

<ListView
    android:id="@+id/android:list"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
     />
</LinearLayout>

(the rest of xml code is the same as the link above)

Any solutions to this?

Thanks!

here the title bar is there and the list view also here I changed the title bar but in order to see the list view items I need to click on them first

Community
  • 1
  • 1
George
  • 5,808
  • 15
  • 83
  • 160
  • need further explanation. Could not understand the problem! – Shajeel Afzal Mar 14 '13 at 18:52
  • Can you see the images?Applying the link as I said (in order to change the background titlebar color) results also in not showing the list view items.You can see that in the images. – George Mar 14 '13 at 18:53
  • Which color have you applied in the style? It looks that the textColor is same as the background color! Share the xml code and the color. – Shajeel Afzal Mar 14 '13 at 19:02
  • In the second image your listViews text color is White! – Shajeel Afzal Mar 14 '13 at 19:08
  • Changing the background from the above xml,the listview items become visible again.But,I don't have any background for textColor..As I figured (google searching) ,you can't change the textcolor for listvie w unless you define custom adpater (which I don't want). – George Mar 14 '13 at 20:46

2 Answers2

1

If I got the problem:

Instead of parent="android:Theme":

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="customTheme" parent="android:Theme"> 
        <item name="android:windowTitleBackgroundStyle">@style/WindowTitleBackground</item>   
    </style> 
</resources>

Use parent="android:Theme.Light":

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="customTheme" parent="android:Theme.Light"> 
        <item name="android:windowTitleBackgroundStyle">@style/WindowTitleBackground</item>   
    </style> 
</resources>

The problem is that you are overriding the native Black theme which has black background and white letters. By switching to Light theme you achieve the black letter also have your own white background!

Note: After that you may have to fix custom theme colors (eg. title text color force to white) to white/black if they do not fit the UI you need.

madlymad
  • 6,367
  • 6
  • 37
  • 68
0

you can use the titlebar object for the purpose...

the link below gives the good explanation on how to do that...

Title bar color change issues

Community
  • 1
  • 1
karan
  • 8,637
  • 3
  • 41
  • 78