0
J'essaye de styler le texte en TabLayout
. Je voudrais gérer les styles tels que font color, size and weight
, changer le texte à partir de ALL CAPSComment styler un TabLayout
Comment puis-je faire?
TabLayout tabLayout = new TabLayout(this);
tabLayout.addTab(tabLayout.newTab().setText("Upload"));
tabLayout.addTab(tabLayout.newTab().setText("Pics"));
tabLayout.addTab(tabLayout.newTab().setText("Vids"));
tabLayout.addTab(tabLayout.newTab().setText("Papers"));
Je voudrais attacher le TabLayout aux styles définis en XML: quelque chose comme:
Alors je l'appelle:
Button button = new Button(mContext);
button.setText("Add New BAG");
button.setTextAppearance(R.style.bttn_style);
button.setTextAppearance(R.style.custom_bttn_style);
res/valeurs/styles.xml
<style name="custom_bttn_style" parent="Widget.AppCompat.Button">
<item name="android:textAllCaps">false</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">#00600f</item>
<item name="android:textSize">18dp</item>
<item name="android:fontFamily">\'Zilla Slab\', serif</item>
</style>
Vielen dank im voraus.