当前位置: 首页>>代码示例>>Java>>正文


Java RelativeLayout.getChildAt方法代码示例

本文整理汇总了Java中android.widget.RelativeLayout.getChildAt方法的典型用法代码示例。如果您正苦于以下问题:Java RelativeLayout.getChildAt方法的具体用法?Java RelativeLayout.getChildAt怎么用?Java RelativeLayout.getChildAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.RelativeLayout的用法示例。


在下文中一共展示了RelativeLayout.getChildAt方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onActionClick

import android.widget.RelativeLayout; //导入方法依赖的package包/类
@Override
protected void onActionClick(View action) {
    super.onActionClick(action);
    CardView cardView = (CardView) action;
    RelativeLayout relativeLayout = (RelativeLayout) cardView.getChildAt(0);
    ImageView imageView = (ImageView) relativeLayout.getChildAt(0);
    switch ((int) imageView.getTag()) {
        case R.drawable.ic_call:
            Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" +
                    event.getContact1().split(":")[1]));
            startActivity(intent);
            break;

        case R.drawable.ic_map:
            startActivity(new Intent(EventDetailActivity.this, MapsActivity.class)
                    .putExtra("location", event.getLocation()));
            break;
    }
}
 
开发者ID:adithya321,项目名称:Instincts-2k17,代码行数:20,代码来源:EventDetailActivity.java

示例2: getGroupView

import android.widget.RelativeLayout; //导入方法依赖的package包/类
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
                         View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = inflater.inflate(R.layout.example_list_item, null);
    }
    RelativeLayout l = (RelativeLayout) ((LinearLayout) convertView).getChildAt(1);
    ((ImageView) l.getChildAt(0)).setImageResource((Integer) groups[groupPosition][0]);
    LinearLayout box = (LinearLayout) l.getChildAt(1);
    TextView title = (TextView) box.getChildAt(0);
    title.setText(groups[groupPosition][1].toString());
    ((TextView) box.getChildAt(1)).setText(groups[groupPosition][2].toString());
    if (isExpanded) {
        title.setTextColor(mContext.getResources().getColorStateList(R.color.base_blue));
        ((ImageView) l.getChildAt(2)).setImageResource(R.drawable.more_up);
        if (groupPosition > 0)
            ((LinearLayout) convertView).getChildAt(0).setVisibility(View.VISIBLE);
    } else {
        title.setTextColor(mContext.getResources().getColorStateList(R.color.new_text_color_first));
        ((ImageView) l.getChildAt(2)).setImageResource(R.drawable.more_dowm);
        ((LinearLayout) convertView).getChildAt(0).setVisibility(View.INVISIBLE);
    }
    return convertView;
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:25,代码来源:ExpandableListAdapter.java

示例3: onClick

import android.widget.RelativeLayout; //导入方法依赖的package包/类
@Override
public void onClick(View view) {
    removeDot();

    RelativeLayout relativeLayout = (RelativeLayout) view;
    FloatingActionButton floatingActionButton = (FloatingActionButton)relativeLayout.getChildAt(0);
    drawView.changeColor(floatingActionButton.getBackgroundTintList().getDefaultColor());

    View dotView = new View(CanvasActivity.this);
    dotView.setTag("dot");
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(32, 32);
    params.addRule(RelativeLayout.CENTER_IN_PARENT);
    relativeLayout.addView(dotView, params);
    dotView.setBackgroundResource(R.drawable.canvas_circle_color_shape);
    lastColorSelectLayout = relativeLayout;
}
 
开发者ID:DSM-GRAM,项目名称:Artist,代码行数:17,代码来源:CanvasActivity.java

示例4: setCurrentItem

import android.widget.RelativeLayout; //导入方法依赖的package包/类
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);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:30,代码来源:ChannelTabPageIndicator.java

示例5: refreshFloor

import android.widget.RelativeLayout; //导入方法依赖的package包/类
void refreshFloor() {
    float translationX = Math.abs(getTranslationX());
    if (translationX <= 300) {

        float p = translationX / 300;

        RelativeLayout parent = (RelativeLayout) getParent();
        View childAt = parent.getChildAt(0);
        if (childAt != this) {
            childAt.setScaleX(mScale + (1 - mScale) * p);
            childAt.setScaleY(mScale + (1 - mScale) * p);
            childAt.setTranslationY(mTranslate - (mTranslate * p));
            parent.invalidate();
        }
    }
}
 
开发者ID:pop1234o,项目名称:BestPracticeApp,代码行数:17,代码来源:SwipeCardLayout.java

示例6: onBindView

import android.widget.RelativeLayout; //导入方法依赖的package包/类
@Override
public void onBindView(@Nullable Bundle savedInstanceState, View rootView) {
    final int size = ITEMS.size();
    for (int i = 0; i < size; i++) {
        LayoutInflater.from(getContext()).inflate(R.layout.bottom_item_icon_text_layout, mBottomBar);
        final RelativeLayout item = (RelativeLayout) mBottomBar.getChildAt(i);
        //设置每个item的点击事件
        item.setTag(i);
        item.setOnClickListener(this);
        final IconTextView itemIcon = (IconTextView) item.getChildAt(0);
        final AppCompatTextView itemTitle = (AppCompatTextView) item.getChildAt(1);
        final BottomTabBean bean = TAB_BEANS.get(i);
        //初始化数据
        itemIcon.setText(bean.getICON());
        itemTitle.setText(bean.getTITLE());
        if (i == mIndexDelegate) {
            itemIcon.setTextColor(mClickedColor);
            itemTitle.setTextColor(mClickedColor);
        }
    }
    final ISupportFragment[] delegateArray = ITEM_DELEGATES.toArray(new ISupportFragment[size]);
    getSupportDelegate().loadMultipleRootFragment(R.id.bottom_bar_delegate_container, mIndexDelegate, delegateArray);

}
 
开发者ID:remerber,项目名称:FastEc,代码行数:25,代码来源:BaseBottomDelegate.java

示例7: testView

import android.widget.RelativeLayout; //导入方法依赖的package包/类
public void testView() {
    assertTrue("Parent View is not Relative Layout", view2test instanceof RelativeLayout);
    RelativeLayout relative = (RelativeLayout) view2test;
    assertTrue("expecting Linear Layout", relative.getChildAt(0) instanceof LinearLayout);
    LinearLayout linearLayout = (LinearLayout) relative.getChildAt(0);
    assertEquals("expecting 4 children", linearLayout.getChildCount(), 4);
    assertEquals(linearLayout.getChildAt(0).getClass(), TextView.class);
    assertEquals(linearLayout.getChildAt(1).getClass(), TextView.class);
    assertEquals(linearLayout.getChildAt(2).getClass(), ImageView.class);
    assertEquals(linearLayout.getChildAt(3).getClass(), TextView.class);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:TestSampleCase.java

示例8: MaxesViewHolder

import android.widget.RelativeLayout; //导入方法依赖的package包/类
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;
}
 
开发者ID:Durian-Inc,项目名称:SwolyV2,代码行数:16,代码来源:MaxesAdapter.java

示例9: resetColor

import android.widget.RelativeLayout; //导入方法依赖的package包/类
private void resetColor() {
    final int count = mBottomBar.getChildCount();
    for (int i = 0; i < count; i++) {
        final RelativeLayout item = (RelativeLayout) mBottomBar.getChildAt(i);
        final IconTextView itemIcon = (IconTextView) item.getChildAt(0);
        itemIcon.setTextColor(Color.GRAY);
        final AppCompatTextView itemTitle = (AppCompatTextView) item.getChildAt(1);
        itemTitle.setTextColor(Color.GRAY);
    }
}
 
开发者ID:remerber,项目名称:FastEc,代码行数:11,代码来源:BaseBottomDelegate.java

示例10: onClick

import android.widget.RelativeLayout; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
    final int tag = (int) v.getTag();
    resetColor();
    final RelativeLayout item = (RelativeLayout) v;
    final IconTextView itemIcon = (IconTextView) item.getChildAt(0);
    itemIcon.setTextColor(mClickedColor);
    final AppCompatTextView itemTitle = (AppCompatTextView) item.getChildAt(1);
    itemTitle.setTextColor(mClickedColor);
    getSupportDelegate().showHideFragment(ITEM_DELEGATES.get(tag), ITEM_DELEGATES.get(mCurrentDelegate));
    //注意先后顺序
    mCurrentDelegate = tag;

}
 
开发者ID:remerber,项目名称:FastEc,代码行数:15,代码来源:BaseBottomDelegate.java


注:本文中的android.widget.RelativeLayout.getChildAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。