user2475470 user2475470 - 1 year ago 85
Android Question

style multiple textviews at activity level

We have multiple textview wights in a GridView nested in a RelativeLayout The textviews have these id's tv1 tv2 ect From here I have multiple layouts for various screen sizes sw400dp sw360dp ect What we would like to accomplish is problematically use one style for the odd numbered tv1 and a different style for tv2 This app has multiple activities. Is this possible might be the best question Next how do I distinguish the odd from even in the Manifest. I am only changing the width the font size only changes from one layout to another.

Answer Source

@James_Duh thanks for the answer but I have a better idea What I did was create two Styles theOdd and theEven making the background color the desired color for each row of TextViews then rather tan apply these in the Manifest file I attached the correct STYLE to the corresponding TextView in the Activity XML file with this line of code

style="@style/theOdd" or style="@style/theEven"

I doubt I can up-vote my answer but it offers more elegance and less code

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download