How to set View style defined in xml file ?

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

How to set View style defined in xml file ?

Postby glock45 » Sun Jul 06, 2008 10:00 am

Hello,

I have style in res/values/strings.xml

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <?xml version="1.0" encoding="utf-8"?>
  3.  
  4. <resources>
  5.  
  6.     <string name="app_name">TestActivity</string>
  7.  
  8.    
  9.  
  10.     <style name="MyStyle" parent="android:Theme" >
  11.  
  12.         <item name="android:textSize">15.5sp</item>
  13.  
  14.         <item name="android:textColor">#008</item>
  15.  
  16.     </style>
  17.  
  18.    
  19.  
  20. </resources>
  21.  
  22.  
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


I want set all attributes from MyStyle to single View. How I can do that without setTheme method ( its sets parametrs for all views ) and without using setTextColor,setTextSize methods ?
glock45
Freshman
Freshman
 
Posts: 4
Joined: Sat Apr 19, 2008 11:21 pm

Top

Postby michael_g_hu » Wed Jul 09, 2008 3:26 am

I think you need to define a new textview which extends the textview and define your style in it, then use the new textview in your layout.
it's a general java knowledge.
michael_g_hu
Developer
Developer
 
Posts: 35
Joined: Fri Mar 21, 2008 9:46 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 4 guests