【发布时间】:2016-02-16 18:12:59
【问题描述】:
我创建了一个样式,添加到我的 textview xml 中并且工作正常,这样:
<TextView
android:id="@+id/userFeedName"
style="@style/feeds_user_connected_style"
android:text="@string/user_name"
/>
但我需要使用java创建一个textview并使用我的风格,我试过了:
TextView textView = new TextView(this);
textView.setTextAppearance(getApplicationContext(), R.style.feeds_user_connected_style);
textView.setText(R.string.user_name);
但 android studio 抛出消息“setTextAppearance 已弃用”。我该如何解决它并使用我的风格?
【问题讨论】: