本文整理汇总了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());
}
}
}
}
示例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;
}
}
}
}
示例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;
}
示例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);
}
}
}