Android选项卡标题小写
也许没什么大不了的,但我没法让它发挥作用。我有一个选项卡导航,我将strings.xml中的选项卡标题作为一个数组:Android选项卡标题小写,android,tabs,lowercase,Android,Tabs,Lowercase,也许没什么大不了的,但我没法让它发挥作用。我有一个选项卡导航,我将strings.xml中的选项卡标题作为一个数组: String[] tbTitles= resources.getStringArray(R.array.tabname); for (int i = 0; i < mAppSectionsPagerAdapter.getCount(); i++) { actionBar.addTab( actionBar.newT
String[] tbTitles= resources.getStringArray(R.array.tabname);
for (int i = 0; i < mAppSectionsPagerAdapter.getCount(); i++) {
actionBar.addTab(
actionBar.newTab()
.setText(tbTitles[i])
.setTabListener(this));
}
}
我还尝试在styles.xml中将此设置为我的tablayout样式:
<item name="textAllCaps">false</item>
false
在旧的androids上,文本总是大写的。当然,它适用于较新的API
我只想将旧API的标题也大写。如果在表格布局中添加以下行,应该可以:
app:tabTextAppearance="@android:style/TextAppearance.Widget.TabWidget"
Android 4.0中选项卡视图的默认主题(Holo主题)的
Android:textAllCaps设置为true。
。如果没有,只需添加它,因为它将与viewpager一起使用
<style name="MyCustomTextAppearance" parent="TextAppearance.Design.Tab">
<item name="textAllCaps">false</item>
</style>
假的
并使用
<android.support.design.widget.TabLayout
app:tabTextAppearance="@style/MyCustomTextAppearance"
.../>
由于没有解决方案对我有效,我最终解决了它,如下所示: 在my styles.xml中添加到
我刚把
<item name="android:actionBarTabTextStyle">@style/My.TabText.Style</item>
@style/My.TabText.style
然后在下面:
<style name="My.TabText.Style" parent="@android:style/Widget.Holo.ActionBar.TabText">
<item name="android:textAllCaps">false</item>
</style>
假的
这是唯一适合我的解决方案
所以重点是添加
android:actionBarTabTextStyle
而不是tabTextAppearance
好吧,我在xml文件中没有表格布局,我只有,当我把它放在那里时,它说找不到TextAppearance。另外,当我在Base.Widget.Design.TabLayout的styles.xml中使用它时,它也不起作用。它说tabTextAppearance是未知的。最后我用@style/My.TabText.style解决了这个问题
<style name="My.TabText.Style" parent="@android:style/Widget.Holo.ActionBar.TabText">
<item name="android:textAllCaps">false</item>
</style>