Sliding tab layout text is uppercase

前端 未结 3 1289
无人及你
无人及你 2021-01-12 13:12

Hi I\'m using Sliding tab layout in my app and it all works great. The only thing I dont understand is why my tabs text are in uppercase.

I\'ve printed the text the

相关标签:
3条回答
  • 2021-01-12 13:20

    Found the answer it was in the createDefaultTabView() method.

    Needed to change textView.setAllCaps(true) to false.

    protected TextView createDefaultTabView(Context context) {
        TextView textView = new TextView(context);
        textView.setGravity(Gravity.CENTER);
        textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
        textView.setLayoutParams(new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    
        TypedValue outValue = new TypedValue();
        getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground,
                outValue, true);
        textView.setBackgroundResource(outValue.resourceId);
        textView.setAllCaps(false); **// Changed to false and it did the trick**
    
        int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
        textView.setPadding(padding, padding, padding, padding);
    
        return textView;
    }
    
    0 讨论(0)
  • 2021-01-12 13:27

    just add this linetabTitleView.setAllCaps(false); in populateTabStrip()

    0 讨论(0)
  • 2021-01-12 13:37

    If you use "android.support.design.widget.TabLayout" needed to set app:tabTextAppearance="@android:style/TextAppearance.Widget.TabWidget"

    0 讨论(0)
提交回复
热议问题