Answer the question
In order to leave comments, you need to log in
Change text size of item listview android?
Greetings!
There is a problem that needs to be solved.
When creating an application, I take a part of the text from HTML and parse it into JSON, after clearing it of unnecessary garbage. Then I insert json objects as a list in listview. Everything is good and pleasant here.
But, in my application I have an option to increase and decrease the text in the item listview. It doesn't work correctly.
Here is how I resize:
int sizeText = 14;
private boolean setChangeTextSize(){
int childCount = lv.getChildCount();
float fSize = Float.parseFloat( sizeText+"");
int i = 0;
while (i < childCount){
View v = lv.getChildAt(i);
TextView tx = (TextView) v.findViewById(R.id.stings);
tx.setTextSize(fSize);
i++;
}
return false;
}
Answer the question
In order to leave comments, you need to log in
Use ArrayAdapter and forget about problems. No other way. At the same time, you can customize the view of the list to suit your needs.
http://habrahabr.ru/post/133575/
Custom markup for listview item with font sizes there is the best option. Implement all dynamic appearance changes in the getView method of your ArrayAdapter.
Nothing will jump!
In the getView in the adapter, set the size too.
This is because when scrolling, what goes beyond the frame is then recreated using getView and the TextView for which you set the size goes to Narnia) It is
recommended to create a static holder class with static fields
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question