Пример #1
0
        /// <summary>
        /// Helper for makeAndAddView to set the position of a view
        /// and fill out its layout paramters.
        /// </summary>
        /// <remarks>
        /// Helper for makeAndAddView to set the position of a view
        /// and fill out its layout paramters.
        /// </remarks>
        /// <param name="child">The view to position</param>
        private void setUpChild(android.view.View child)
        {
            // Respect layout params that are already in the view. Otherwise
            // make some up...
            android.view.ViewGroup.LayoutParams lp = child.getLayoutParams();
            if (lp == null)
            {
                lp = generateDefaultLayoutParams();
            }
            addViewInLayout(child, 0, lp);
            child.setSelected(hasFocus());
            // Get measure specs
            int childHeightSpec = android.view.ViewGroup.getChildMeasureSpec(mHeightMeasureSpec
                                                                             , mSpinnerPadding.top + mSpinnerPadding.bottom, lp.height);
            int childWidthSpec = android.view.ViewGroup.getChildMeasureSpec(mWidthMeasureSpec
                                                                            , mSpinnerPadding.left + mSpinnerPadding.right, lp.width);

            // Measure child
            child.measure(childWidthSpec, childHeightSpec);
            int childLeft;
            int childRight;
            // Position vertically based on gravity setting
            int childTop = mSpinnerPadding.top + ((getMeasuredHeight() - mSpinnerPadding.bottom
                                                   - mSpinnerPadding.top - child.getMeasuredHeight()) / 2);
            int childBottom = childTop + child.getMeasuredHeight();
            int width       = child.getMeasuredWidth();

            childLeft  = 0;
            childRight = childLeft + width;
            child.layout(childLeft, childTop, childRight, childBottom);
        }
 public virtual void onClick(android.view.View view)
 {
     [email protected] tabView = ([email protected]
                                                                           .TabView)view;
     tabView.getTab().select();
     int tabCount = this._enclosing.mTabLayout.getChildCount();
     {
         for (int i = 0; i < tabCount; i++)
         {
             android.view.View child = this._enclosing.mTabLayout.getChildAt(i);
             child.setSelected(child == view);
         }
     }
 }
 public virtual void setTabSelected(int position)
 {
     mSelectedTabIndex = position;
     int tabCount = mTabLayout.getChildCount();
     {
         for (int i = 0; i < tabCount; i++)
         {
             android.view.View child = mTabLayout.getChildAt(i);
             bool isSelected_1       = i == position;
             child.setSelected(isSelected_1);
             if (isSelected_1)
             {
                 animateToTab(position);
             }
         }
     }
 }