关于android 动态设置view 样式 问题(默认style)


解决方案一:

Button btn=new Button(new ContextThemeWrapper(mContext,R.style.service_text_dialog_style),null,R.style.service_text_dialog_style);

解决方案二(待验证):

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="This is a template"
        style="@style/my_style" />
TextView myText = (TextView)getLayoutInflater().inflate(R.layout.tvtemplate, null);

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM