當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。