views:

371

answers:

1

I have defined style for "TabWidget" as below:

<style name="MyTheme" parent="@android:style/Theme.Light">
        <item name="android:tabWidgetStyle">@style/LightTabWidget</item>
</style>

<style name="LightTabWidget" parent="@android:style/Widget.TabWidget">
            <item name="android:textSize">12px</item>
</style>

In which i am setting font-size 12px for TabWidget Indicator(title) font.

Now, my problem: Same way of Tabwidget style modification, i want to modify style for Listview for incresing/decreasing font-size. I know we can modify font-size of listview by defining custom-layout for Listview. But if there is a way to do by styles.xml then pls help me and let me know.

+1  A: 

AFAIK, Default tab_indicator.xml has the style attribute. but for the default ListView layout simple_list_item_1.xml does not have it. so its not possible. But you can achieve it by custom adapter for the ListView.

Edit: you can use only the custom adapter to customize the list item. It mentioned in the ArrayAdapter Documentation.

From the Documentation:

A ListAdapter that manages a ListView backed by an array of arbitrary objects. By default this class expects that the provided resource id references a single TextView. If you want to use a more complex layout, use the constructors that also takes a field id. That field id should reference a TextView in the larger layout resource. However the TextView is referenced, it will be filled with the toString() of each object in the array. You can add lists or arrays of custom objects. Override the toString() method of your objects to determine what text will be displayed for the item in the list. To use something other than TextViews for the array display, for instance, ImageViews, or to have some of data besides toString() results fill the views, override getView(int, View, ViewGroup) to return the type of view you want.

Praveen Chandrasekaran
@Praveen simple_list_item_1.xml is having a textview, then is it possible to mention android:textSize attribute for textview??
PM - Paresh Mayani
@Paresh Mayani: AFAIK, we can override the style. But not an attribute. i did not work on it yet. if it is possible. Let you know.
Praveen Chandrasekaran
@Praveen ohhkk thanx for the support, and ya i know that we can change the font-size of listview by defining custom-adapter but if it done with the changing in "style.xml" way then its good for me so
PM - Paresh Mayani