Java Code Examples for android.widget.RelativeLayout.getChildCount()

The following are Jave code examples for showing how to use getChildCount() of the android.widget.RelativeLayout class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: letv   File: ChannelTabPageIndicator.java   Source Code and License Vote up 6 votes
public void setCurrentItem(int item) {
    if (this.mViewPager != null) {
        if (item != -1 || this.mSelectedTabIndex != item) {
            this.mSelectedTabIndex = item;
            int tabCount = this.mTabLayout.getChildCount();
            for (int i = 0; i < tabCount; i++) {
                RelativeLayout childLayout = (RelativeLayout) this.mTabLayout.getChildAt(i);
                for (int j = 0; j < childLayout.getChildCount(); j++) {
                    boolean isSelected;
                    if (i == item) {
                        isSelected = true;
                    } else {
                        isSelected = false;
                    }
                    View view = childLayout.getChildAt(j);
                    if (view instanceof TabView) {
                        view.setSelected(isSelected);
                        if (isSelected) {
                            animateToTab(item);
                        }
                    } else {
                        view.setSelected(isSelected);
                    }
                }
            }
            this.mViewPager.setCurrentItem(item, false);
        }
    }
}
 
Example 2
Project: SwolyV2   File: MaxesAdapter.java   Source Code and License Vote up 5 votes
public MaxesViewHolder(View view){
    super(view);
    lift = (TextView) view.findViewById(R.id.liftTitle);
    weight = (TextView) view.findViewById(R.id.weight);
    cardLayout = (RelativeLayout) view.findViewById(R.id.relative);
    floatingActionButton = (FloatingActionButton) view.findViewById(R
            .id.additionFAB);
    for(short i =0; i<cardLayout.getChildCount(); i++){
        if(cardLayout.getChildAt(i) instanceof AppCompatButton){
            cardButtons.add((AppCompatButton) cardLayout.getChildAt(i));
        }
    }
    vertMenu = (ImageView) view.findViewById(R.id.cardMenu);
    viewCard = view;
}
 
Example 3
Project: lrs_android   File: AutoScrollViewPager.java   Source Code and License Vote up 5 votes
public void setupIndicator(RelativeLayout indicator) {
    this.indicator = indicator;
    if (indicator == null) {
        return;
    }
    if (indicator.getChildCount() > 0) {
        indicator.removeAllViews();
    }
    ringList = new ArrayList<ImageView>();
    RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    lp.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
    LinearLayout ll = new LinearLayout(context);
    ll.setLayoutParams(lp);
    indicator.addView(ll);
    LinearLayout.LayoutParams lpp = new LinearLayout.LayoutParams(DisplayUtil.dp2px(7), DisplayUtil.dp2px(7));
    for (int i = 0; i < pageCount; i++) {
        ImageView iv = new ImageView(context);
        iv.setLayoutParams(lpp);
        if (pageCount == 1) {
            iv.setBackgroundResource(R.drawable.ring_imageview_select);
        }
        if (i > 0) {
            lpp.leftMargin = DisplayUtil.dp2px(3);
        }
        ringList.add(iv);
        ll.addView(iv);
    }
}