I have a ListView. When I try to make it's row's textview bold - it falls. I try:
ListView list = (ListView) findViewById(R.id.my_list);
list.setAdapter(someListAdapter);
((TextView) list.getChildAt(0).findViewById(R.id.first_name)).setTypeface(null, Typeface.BOLD);
I need to do this with only one (headers) row's textviews.
I need to do this with only one (headers) row's textviews.
Try calling this before calling addHeaderView(view)
:
((TextView) view.findViewById(R.id.first_name)).setTypeface(null, Typeface.BOLD);
If you not using addHeaderView()
, extend your adapter and add a snippet of code like this to getView()
:
if(position == 0)
((TextView) convertView.findViewById(R.id.first_name)).setTypeface(null, Typeface.BOLD);
else
((TextView) convertView.findViewById(R.id.first_name)).setTypeface(null, Typeface.NORMAL);
(I recommend using a ViewHolder, rather than calling findViewById()
repeatedly. This is just for a quick example.)