Ciao Sto utilizzando il layout delle schede scorrevoli nella mia app e tutto funziona alla grande. L'unica cosa che non capisco è perché il mio testo delle schede è in maiuscolo.Il testo del layout delle schede scorrevoli è maiuscolo
Ho stampato il testo che le schede entrano nella classe della scheda scorrevole e non sono maiuscole. Mi sono guardato intorno e non è stato chiamato alcun metodo toUpperCase.
ecco il codice dalla classe che imposta il testo:
private void populateTabStrip() {
final PagerAdapter adapter = mViewPager.getAdapter();
final View.OnClickListener tabClickListener = new TabClickListener();
for (int i = 0; i < adapter.getCount(); i++) {
View tabView = null;
TextView tabTitleView = null;
if (mTabViewLayoutId != 0) {
// If there is a custom tab view layout id set, try and inflate it
tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip,
false);
tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId);
}
if (tabView == null) {
tabView = createDefaultTabView(getContext());
}
if (tabTitleView == null && TextView.class.isInstance(tabView)) {
tabTitleView = (TextView) tabView;
}
if (mDistributeEvenly) {
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams();
lp.width = 0;
lp.weight = 1;
}
tabTitleView.setText(adapter.getPageTitle(i));
tabTitleView.setTextColor(getResources().getColor(R.color.da_blue));
tabView.setOnClickListener(tabClickListener);
String desc = mContentDescriptions.get(i, null);
if (desc != null) {
tabView.setContentDescription(desc);
}
mTabStrip.addView(tabView);
if (i == mViewPager.getCurrentItem()) {
tabView.setSelected(true);
}
}
}
Sono sicuro che posso farlo attraverso uno stile, ma in realtà non sono sicuro quale utilizzare. Questo è quello che ho nei miei stili:
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:actionBarTabTextStyle">@style/ActionBarTabTextStyle.Tabtheme</item>
<item name="actionBarTabTextStyle">@style/ActionBarTabTextStyle.Tabtheme</item>
</style>
<style name="ActionBarTabTextStyle.Tabtheme" parent="@android:style/Widget.Holo.ActionBar.TabText">
<item name="android:textAllCaps">false</item>
</style>
</resources>
Stai vedendo questo a L? Questo è un comportamento predefinito. Puoi fare riferimento a questa risposta se non vuoi tutte le maiuscole. http://stackoverflow.com/questions/26958909/why-is-my-button-text-coerced-to-all-caps-on-lollipop/26959656#26959656 –