4

I have more dimens

<resources>
    <dimen name="tag_text_size">10dp</dimen>
    <dimen name="text_separator_size">15dp</dimen>
    <dimen name="tag_text_count_size">8dp</dimen>
    <dimen name="text_home_page_size">20dp</dimen>
    <dimen name="item_text_head_size">15dp</dimen>
    <dimen name="item_text_time_size">10dp</dimen>
    <dimen name="item_text_price_size">14dp</dimen>
    <dimen name="item_text_address_pattern_size">12dp</dimen>
    <dimen name="item_text_address_size">14dp</dimen>
 <dimen name="setting_text_head_size">24dp</dimen>
  <dimen name="order_text_comment_size">11dp</dimen>
</resources>

and i use this dimen in my XML ..

 <TextView
 android:textSize="@dimen/item_text_head_size" />

...

I want to programmatically change the dimen, it will allow me to change the size of strings everywhere

how can this be solved?

Max Usanin
  • 2,479
  • 6
  • 40
  • 70

1 Answers1

6

It is impossible to set the values for the dimen variables in your dimen.xml file programmatically from the activity.

The way to do what you want is to delete your android:textSize attributes and to change the text size at runtime using setTextSize() in Java.

Dr.jacky
  • 3,341
  • 6
  • 53
  • 91
timonvlad
  • 1,046
  • 3
  • 13
  • 31
  • Oh, I see what he is trying to do. I thought he meant reuse his values from his xml programmitically, not edit the file. sorry. +1 – IAmGroot Dec 04 '12 at 09:50