How we add styles programmatically?

前端 未结 1 1588
说谎
说谎 2020-12-21 23:43

I have written one style for TextView and I set that one for my TextView as style=\"@style/popup_window_text_style\" working fine, no issues.

1条回答
  •  [愿得一人]
    2020-12-22 00:06

    This should work for you:

    textView.setTextAppearance(getApplicationContext(), R.style.popup_window_text_style);
    

    But note that some properties may not be affected and may have to be set manually as specified in the Android developer docs.

    Unfortunately the current SDK appears to lack any form of a setStyle() method.

    0 讨论(0)
提交回复
热议问题