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


Java LinearLayout.findViewWithTag方法代码示例

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


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

示例1: updateChildInfo

import android.widget.LinearLayout; //导入方法依赖的package包/类
public void updateChildInfo(String childId, UserInfo userInfo) {
    int containerCount = linearLayout.getChildCount();

    LinearLayout lastContainer = null;
    for (int i = 0; i < containerCount; i++) {
        LinearLayout container = (LinearLayout) linearLayout.getChildAt(i);
        LinearLayout child = (LinearLayout) container.findViewWithTag(childId);
        if (child != null) {
            AsyncImageView imageView = (AsyncImageView)child.findViewById(R.id.rc_user_portrait);
            imageView.setAvatar(userInfo.getPortraitUri());
            if (enableTitle) {
                TextView textView = (TextView)child.findViewById(R.id.rc_user_name);
                textView.setText(userInfo.getName());
            }
        }
    }
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:18,代码来源:CallUserGridView.java

示例2: removeChild

import android.widget.LinearLayout; //导入方法依赖的package包/类
public void removeChild(String childId) {
    int containerCount = linearLayout.getChildCount();

    LinearLayout lastContainer = null;
    List<LinearLayout> containerList = new ArrayList<>();
    for (int i = 0; i < containerCount; i++) {
        LinearLayout container = (LinearLayout) linearLayout.getChildAt(i);
        containerList.add(container);
    }
    for (LinearLayout resultContainer : containerList) {
        if (lastContainer == null) {
            LinearLayout child = (LinearLayout) resultContainer.findViewWithTag(childId);
            if (child != null) {
                resultContainer.removeView(child);
                if (resultContainer.getChildCount() == 0) {
                    linearLayout.removeView(resultContainer);
                    break;
                } else {
                    lastContainer = resultContainer;
                }
            }
        } else {
            View view = resultContainer.getChildAt(0);
            resultContainer.removeView(view);
            lastContainer.addView(view);
            if (resultContainer.getChildCount() == 0) {
                linearLayout.removeView(resultContainer);
                break;
            } else {
                lastContainer = resultContainer;
            }
        }
    }
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:35,代码来源:CallUserGridView.java

示例3: findChildById

import android.widget.LinearLayout; //导入方法依赖的package包/类
public View findChildById(String childId) {
    int containerCount = linearLayout.getChildCount();

    for (int i = 0; i < containerCount; i++) {
        LinearLayout container = (LinearLayout) linearLayout.getChildAt(i);
        LinearLayout child = (LinearLayout) container.findViewWithTag(childId);
        if (child != null) {
            return child;
        }
    }
    return null;
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:13,代码来源:CallUserGridView.java

示例4: updateChildState

import android.widget.LinearLayout; //导入方法依赖的package包/类
public void updateChildState(String childId, String state) {
    int containerCount = linearLayout.getChildCount();

    for (int i = 0; i < containerCount; i++) {
        LinearLayout container = (LinearLayout) linearLayout.getChildAt(i);
        LinearLayout child = (LinearLayout) container.findViewWithTag(childId);
        if (child != null) {
            TextView textView = (TextView)child.findViewById(R.id.rc_voip_member_state);
            textView.setText(state);
        }
    }
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:13,代码来源:CallUserGridView.java


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