tns-core-modules-widgets/android/widgets/src/main/java/org/nativescript/widgets/BottomNavigationBar.java
/**
     * Create a default view to be used for tabs.
     */
Create a default view to be used for tabs.
Create a default view to be used for tabs .
protected View createDefaultTabView(Context context, TabItemSpec tabItem) {
        float density = getResources().getDisplayMetrics().density;
        LinearLayout ll = new LinearLayout(context);
        ll.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT));
        ll.setGravity(Gravity.CENTER);
        ll.setOrientation(LinearLayout.VERTICAL);
        TypedValue outValue = new TypedValue();
        getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
        ll.setBackgroundResource(outValue.resourceId);
        ImageView imgView = new ImageView(context);
        imgView.setScaleType(ScaleType.FIT_CENTER);
        LinearLayout.LayoutParams imgLP = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        imgLP.gravity = Gravity.CENTER;
        imgView.setLayoutParams(imgLP);
        TextView textView = new TextView(context);
        textView.setGravity(Gravity.CENTER);
        textView.setMaxWidth((int) (ITEM_TEXT_MAX_WIDTH * density));
        textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, ITEM_TEXT_SIZE_SP);
        textView.setTypeface(Typeface.DEFAULT_BOLD);
        textView.setEllipsize(TextUtils.TruncateAt.END);
        textView.setMaxLines(1);
        textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
        this.setupItem(ll, textView, imgView, tabItem);
        ll.addView(imgView);
        ll.addView(textView);
        return ll;
    }
protected View createDefaultTabView ( Context context , TabItemSpec tabItem ) { float density = getResources ( ) . getDisplayMetrics ( ) . density ; LinearLayout ll = new LinearLayout ( context ) ; ll . setLayoutParams ( new LinearLayout . LayoutParams ( ViewGroup . LayoutParams . WRAP_CONTENT , ViewGroup . LayoutParams . MATCH_PARENT ) ) ; ll . setGravity ( Gravity . CENTER ) ; ll . setOrientation ( LinearLayout . VERTICAL ) ; TypedValue outValue = new TypedValue ( ) ; getContext ( ) . getTheme ( ) . resolveAttribute ( android . R . attr . selectableItemBackground , outValue , true ) ; ll . setBackgroundResource ( outValue . resourceId ) ; ImageView imgView = new ImageView ( context ) ; imgView . setScaleType ( ScaleType . FIT_CENTER ) ; LinearLayout . LayoutParams imgLP = new LinearLayout . LayoutParams ( ViewGroup . LayoutParams . WRAP_CONTENT , ViewGroup . LayoutParams . WRAP_CONTENT ) ; imgLP . gravity = Gravity . CENTER ; imgView . setLayoutParams ( imgLP ) ; TextView textView = new TextView ( context ) ; textView . setGravity ( Gravity . CENTER ) ; textView . setMaxWidth ( ( int ) ( ITEM_TEXT_MAX_WIDTH * density ) ) ; textView . setTextSize ( TypedValue . COMPLEX_UNIT_SP , ITEM_TEXT_SIZE_SP ) ; textView . setTypeface ( Typeface . DEFAULT_BOLD ) ; textView . setEllipsize ( TextUtils . TruncateAt . END ) ; textView . setMaxLines ( 1 ) ; textView . setLayoutParams ( new LinearLayout . LayoutParams ( ViewGroup . LayoutParams . WRAP_CONTENT , ViewGroup . LayoutParams . WRAP_CONTENT ) ) ; this . setupItem ( ll , textView , imgView , tabItem ) ; ll . addView ( imgView ) ; ll . addView ( textView ) ; return ll ; }
Create a default view to be used for tabs.
Create a default view to be used for tabs .