I am populating (through inflation) an XML file and then I want to
update the textSize of each TextView and redraw it, but it's not
updating the view with new textSize.
Here is the code:
public class Contacts extends ListActivity {
private SimpleCursorAdapter mAdapter;
private Integer totalContactsMade;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Cursor cursor = getContentResolver().query
(People.CONTENT_URI,
null, null, null, People.NAME + " ASC");
startManagingCursor(cursor);
String[] columns = new String[] { People.NAME};
int[] names = new int[] {R.id.row_entry};
mAdapter = new SimpleCursorAdapter(this, R.layout.main,
cursor, columns, names);
setListAdapter(mAdapter);
Integer contactCount = getListView().getCount();
for(Integer i=0; i<contactCount; i++) {
LinearLayout layout = (LinearLayout)
mAdapter.getView(i, null,
null);
if(layout != null) {
TextView view = (TextView)
layout.findViewById(R.id.row_entry);
if(view != null) {
view.setTextSize(6.0f);
view.requestFocus();
view.getParent().requestLayout
();
view.requestLayout();
view.postInvalidate();
// I have tried to invalidate
the layout also, but it doesn't work
layout.requestFocus();
layout.requestLayout();
layout.postInvalidate();
}
}
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en