Android 以编程方式更改表格布局样式
我已经在Android 以编程方式更改表格布局样式,android,android-tablayout,Android,Android Tablayout,我已经在styles.xml文件中为选项卡布局创建了自定义样式 styles.xml <style name="NormalTabLayputTheme" parent="ThemeOverlay.AppCompat.Light"> <item name="tabTextAppearance">@style/NormalTabLayputTheme</item> </style> <style name="NormalTabText
styles.xml
文件中为选项卡布局创建了自定义样式
styles.xml
<style name="NormalTabLayputTheme" parent="ThemeOverlay.AppCompat.Light">
<item name="tabTextAppearance">@style/NormalTabLayputTheme</item>
</style>
<style name="NormalTabTextAppearance" parent="TextAppearance.Design.Tab">
<item name="android:textSize">14sp</item>
<item name="textAllCaps">false</item>
</style>
@样式/正常布局
14便士
假的
我能够将布局文件中的样式用作
<android.support.design.widget.TabLayout
android:id="@+id/marketsTabs"
style="@style/NormalTabLayputTheme"
android:layout_width="match_parent"
android:layout_height="@dimen/dashboard_viewpager_tab_height"
app:paddingStart="1dp"
app:tabIndicatorHeight="3dp"
app:tabIndicatorColor="@color/view_pager_indicator_color"
app:tabSelectedTextColor="@color/nintypercentblack"
app:tabTextColor="@color/sixtypercentblack">
一切正常。但是我想在运行时更改样式。我已经检查了stackoverflow,但是没有发现任何关于这个的信息。可能吗
我尝试过制作一个自定义布局
类扩展布局
,但也没有成功。试试这个: