Loading style via code

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

Loading style via code

Postby sandis84 » Mon Aug 10, 2009 8:15 am

I have defined a style in xml. Now I want to programmaticaly define a listview that uses this style. Could someone please give me guidance?

EDIT: Ok, I have made some weird progress. Allow me to show you. This is my style:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <resources>
  4.  
  5.     <style name="listview_style">
  6.  
  7.                 <item name="android:layout_width">fill_parent</item>
  8.  
  9.                 <item name="android:layout_height">50dp</item>
  10.  
  11.                 <item name="android:divider">#91BDD8</item>
  12.  
  13.                 <item name="android:headerDividersEnabled">true</item>
  14.  
  15.                 <item name="android:dividerHeight">1px</item>
  16.  
  17.                 <item name="android:cacheColorHint">#ffffff</item>
  18.  
  19.                 <item name="android:fadingEdgeLength">160dp</item>
  20.  
  21.    </style>
  22.  
  23. </resources>
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


and here I try to load it:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. listListView = new ListView(this,null,R.id.todo_main_list);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


the AttributSet is null only cause I dont know how to use it.
sandis84
Experienced Developer
Experienced Developer
 
Posts: 78
Joined: Fri Aug 07, 2009 3:54 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 3 guests