हाय मैं अपने ऐप में स्लाइडिंग टैब लेआउट का उपयोग कर रहा हूं और यह सब बहुत अच्छा काम करता है। केवल एक चीज जिसे मैं समझ नहीं पा रहा हूं, मेरा टैब टेक्स्ट अपरकेस में क्यों है।स्लाइडिंग टैब लेआउट टेक्स्ट अपरकेस
मैंने टैब को स्लाइडिंग टैब क्लास के अंदर प्राप्त टेक्स्ट मुद्रित किया है और वे अपरकेस में नहीं हैं। मैंने चारों ओर देखा है और अपरकेस विधि को कॉल करने के लिए कोई नहीं है।
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);
}
}
}
मुझे लगता है मैं एक शैली के माध्यम से यह कर सकते हैं सुनिश्चित करें, लेकिन वास्तव में नहीं पता कि कौन से एक का उपयोग करने के लिए नहीं कर रहा हूँ:
यहाँ वर्ग है कि पाठ सेट से कोड है। मेरे पास मेरी शैलियों में यही है:
<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>
आप एल में यह देख रहे हैं? यह डिफ़ॉल्ट व्यवहार है। यदि आप सभी कैप्स नहीं चाहते हैं तो आप इस जवाब का उल्लेख कर सकते हैं। http://stackoverflow.com/questions/26958909/why-is-my-button-text-coerced-to-all-caps-on-lollipop/26959656#26959656 –