Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/191.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/jenkins/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 以编程方式更改表格布局样式_Android_Android Tablayout - Fatal编程技术网

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,但是没有发现任何关于这个的信息。可能吗

我尝试过制作一个
自定义布局
类扩展
布局
,但也没有成功。

试试这个: