Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Change Text Size and Style in ListView?

Change Text Size and Style in ListView?

Put your problem here if it does not fit any of the other categories.

Change Text Size and Style in ListView?

Postby gilgantic » Mon Feb 25, 2008 5:27 am

How do I change the text size and style of text in my ListView? I have tried android:textSize and other sizing/style attributes on my ListView in layout\menu.xml, but they do not work. Any suggestions?

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class Menu extends ListActivity implements OnItemSelectedListener{
  2.  
  3.                           .
  4.  
  5.         // Create an array of Strings, that will be put to our ListActivity
  6.  
  7.     private CharSequence[] menuItems_;
  8.  
  9.                           .
  10.  
  11.     public void onCreate(Bundle icicle) {
  12.  
  13.         super.onCreate(icicle);
  14.  
  15.         setContentView(R.layout.menu);
  16.  
  17.                           .
  18.  
  19.         menuItems_ = getResources().getTextArray(R.array.menu);
  20.  
  21.                           .
  22.  
  23.         // Populate day menu items.
  24.  
  25.         getListView().setOnItemSelectedListener(this);
  26.  
  27.         this.setListAdapter(ArrayAdapter.createFromResource(this, R.array.menu,
  28.  
  29.                 android.R.layout.simple_list_item_1));
  30.  
  31.     }
  32.  
  33.                           .
  34.  
  35. }
Parsed in 0.013 seconds, using GeSHi 1.0.8.4


values\arrays.xml
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <resources>
  4.  
  5.  
  6.  
  7.     <!-- Menu -->
  8.  
  9.     <array name="menu">
  10.  
  11.             <item>Add</item>
  12.  
  13.             <item>Delete</item>
  14.  
  15.             <item>Search</item>
  16.  
  17.             <item>Display</item>
  18.  
  19.     </array>
  20.  
  21.    
  22.  
  23. </resources>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


layout\menu.xml
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <AbsoluteLayout
  4.  
  5.         android:layout_width="fill_parent"
  6.  
  7.         android:layout_height="fill_parent"
  8.  
  9.         xmlns:android="http://schemas.android.com/apk/res/android"
  10.  
  11.         >
  12.  
  13.                           .
  14.  
  15.         <!-- Here is the list. Since we are using a ListActivity, we
  16.  
  17.             have to call it "@android:id/list" so ListActivity will
  18.  
  19.             find it -->
  20.  
  21.                 <ListView
  22.  
  23.                         android:id="@android:id/list"
  24.  
  25.                         android:layout_width="140px"
  26.  
  27.                         android:layout_height="230px"
  28.  
  29.                         android:layout_x="15px"
  30.  
  31.                         android:layout_y="40px"
  32.  
  33.                         />
  34.  
  35.                           .
  36.  
  37. </AbsoluteLayout>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


Thanks in Advance! :D
gilgantic
gilgantic
Freshman
Freshman
 
Posts: 6
Joined: Sun Feb 24, 2008 11:08 pm

Top

Postby plusminus » Mon Feb 25, 2008 9:52 am

Hello gilgantic,

The style of the listitems is defined through what resourceID you create your Adapter with. Here:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. android.R.layout.simple_list_item_1
Parsed in 0.011 seconds, using GeSHi 1.0.8.4


Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 12 guests