setTag ( )源码实例Demo

android.view.ViewGroup#setTag ( )源码实例Demo

下面列出了android.view.ViewGroup#setTag ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@Override
public View getView(View convertView) {
    View view;
    TextHolder holder;

    if (convertView == null) {
        ViewGroup rowRoot = (ViewGroup) inflater.inflate(R.layout.listview_row_not_supported, null);
        TextView label = (TextView) rowRoot.findViewById(R.id.text_label);

        holder = new TextHolder(label);
        rowRoot.setTag(holder);
        view = rowRoot;
    } else {
        view = convertView;
        holder = (TextHolder) view.getTag();
    }

    RowCosmetics.setTextLabel(field, holder.textLabel);
    return view;
}
 
源代码2 项目: MVVM-JueJin   文件: ViewGroupAdapter.java
/**
 * (伪)双向 databinding: 同 {@link RecyclerViewAdapter#setDataTwoWay(RecyclerView, ListVM, List)}
 *
 * @param container
 * @param vm
 * @param datas
 * @param <T>
 */
@BindingAdapter({"vm", "data"})
public static <T> void setDataTwoWay(final ViewGroup container, final ListVM<T> vm, List<T> datas){
    if(vm == null){
        return ;
    }
    bind(container, vm, datas);

    if(vm instanceof TwoWayListVM){
        boolean isInited = container.getTag(R.id.db_inited) != null;
        if(!isInited) {
            container.setTag(R.id.db_inited, true);
            loadData(container, (TwoWayListVM<T>)vm, null, null);
        }
    }
}
 
源代码3 项目: RewardLayout   文件: RewardLayout.java
/**
 * 添加礼物到空闲的framelayout,在覆盖的时候可能存在礼物离场动画还么结束view还没有被remove的情况下
 * 根据该view的enable判断
 *
 * @param view
 */
private void addChildGift(View view) {
    for (int i = 0; i < getChildCount(); i++) {
        ViewGroup itemGroup = (ViewGroup) getChildAt(i);
        if (itemGroup.getChildCount() == 0) {
            itemGroup.addView(view);
            itemGroup.setTag(((GiftIdentify) view.getTag()).getTheLatestRefreshTime());
            break;
        } else {
            boolean isAllCancel = true;
            for (int j = 0; j < itemGroup.getChildCount(); j++) {
                if (itemGroup.getChildAt(j).isEnabled()) {
                    isAllCancel = false;
                    break;
                }
            }
            if (isAllCancel) {
                itemGroup.addView(view);
                itemGroup.setTag(((GiftIdentify) view.getTag()).getTheLatestRefreshTime());
                break;
            }
        }
    }
}
 
源代码4 项目: barterli_android   文件: NavDrawerFragment.java
/**
 * Initialize the profile header views. Reads the references to the child views and stores them
 * as tags
 */
private void initProfileHeaderViews() {

    //Get references to the two primary containers
    final ViewGroup profileContainer = (ViewGroup) mProfileHeader
            .findViewById(R.id.container_profile_info);
    mProfileHeader.setTag(R.id.container_profile_info, profileContainer);

    final ViewGroup signInContainer = (ViewGroup) mProfileHeader
            .findViewById(R.id.container_sign_in_message);
    mProfileHeader.setTag(R.id.container_sign_in_message, signInContainer);

    //Get references to the individual container children and set tags
    profileContainer
            .setTag(R.id.text_user_name, profileContainer.findViewById(R.id.text_user_name));
    profileContainer.setTag(R.id.image_user, profileContainer.findViewById(R.id.image_user));

    TextView textView = (TextView) signInContainer.findViewById(R.id.text_nav_item_title);
    textView.setText(R.string.text_sign_in);
    signInContainer.setTag(R.id.text_nav_item_title, textView);

}
 
@Override
protected View getViewImpl(int position, View convertView, ViewGroup parent) {
    ViewHolder viewHolder;
    if (convertView == null) {
        int layout = R.layout.complex_item;
        LayoutInflater inflater = LayoutInflater.from(getContext());
        ViewGroup group = (ViewGroup) inflater.inflate(layout, parent, false);
        convertView = group;
        viewHolder = new ViewHolder();
        viewHolder.nameTextView = (TextView) group.findViewById(R.id.fName1);
        viewHolder.progressBar = (ProgressBar) group.findViewById(R.id.lp1);
        group.setTag(viewHolder);
    } else {
        viewHolder = (ViewHolder) convertView.getTag();
    }
    String country = getItem(position);
    viewHolder.nameTextView.setText(country);
    viewHolder.progressBar.setProgress(random.nextInt(100));
    return convertView;
}
 
@Override
public void onClick(View view) {
    ImageView pickedView = (ImageView) view;
    ViewGroup pickerBox = (ViewGroup) view.getParent();

    // Clear old selection.
    for (int i = 0; i < pickerBox.getChildCount(); i++) {
        ImageView childView = (ImageView) pickerBox.getChildAt(i);
        childView.setBackgroundResource(R.drawable.unselected_background);
    }

    // Set new selection.
    pickedView.setBackgroundResource(R.drawable.selected_background);
    pickerBox.setTag(pickedView.getTag());

    if (listener != null) {
        listener.onBackgroundPickersChanged(BackgroundPickers.this);
    }
}
 
源代码7 项目: Transitions-Everywhere   文件: Scene.java
/**
 * Returns a Scene described by the resource file associated with the given
 * <code>layoutId</code> parameter. If such a Scene has already been created,
 * that same Scene will be returned. This caching of layoutId-based scenes enables
 * sharing of common scenes between those created in code and those referenced
 * by {@link TransitionManager} XML resource files.
 *
 * @param sceneRoot The root of the hierarchy in which scene changes
 *                  and transitions will take place.
 * @param layoutId  The id of a standard layout resource file.
 * @param context   The context used in the process of inflating
 *                  the layout resource.
 * @return
 */
@NonNull
public static Scene getSceneForLayout(@NonNull ViewGroup sceneRoot, int layoutId, @NonNull Context context) {
    SparseArray<Scene> scenes = (SparseArray<Scene>) sceneRoot.getTag(R.id.scene_layoutid_cache);
    if (scenes == null) {
        scenes = new SparseArray<Scene>();
        sceneRoot.setTag(R.id.scene_layoutid_cache, scenes);
    }
    Scene scene = scenes.get(layoutId);
    if (scene != null) {
        return scene;
    } else {
        scene = new Scene(sceneRoot, layoutId, context);
        scenes.put(layoutId, scene);
        return scene;
    }
}
 
源代码8 项目: FimiX8-RE   文件: MediaDetailPresenter.java
public Object instantiateItem(ViewGroup container, int position) {
    MediaModel mediaModel = (MediaModel) this.modelList.get(position);
    View view = LayoutInflater.from(this.mMediaActivity.getApplicationContext()).inflate(R.layout.album_adapter_detail_item, container, false);
    MediaDetialViewHolder viewHolder = new MediaDetialViewHolder(view);
    container.setTag(viewHolder);
    this.cacheContainer = container;
    initItemData(viewHolder, position, mediaModel);
    container.addView(view);
    return view;
}
 
源代码9 项目: dhis2-android-datacapture   文件: LongTextRow.java
@Override
public View getView(View convertView) {
    View view;
    EditTextHolder holder;
    
    if (convertView == null) {
        ViewGroup rowRoot = (ViewGroup) inflater.inflate(R.layout.listview_row_long_text, null);
        TextView label = (TextView) rowRoot.findViewById(R.id.text_label);
        EditText editText = (EditText) rowRoot.findViewById(R.id.edit_long_text_row);
       
        EditTextWatcher watcher = new EditTextWatcher(field);
        editText.addTextChangedListener(watcher);
        
        holder = new EditTextHolder(label, editText, watcher);
        rowRoot.setTag(holder);
        view = rowRoot;
    } else {
        view = convertView;
        holder = (EditTextHolder) view.getTag();
    }

    RowCosmetics.setTextLabel(field, holder.textLabel);
    
    holder.textWatcher.setField(field);
    holder.editText.addTextChangedListener(holder.textWatcher);
    holder.editText.setText(field.getValue());
    holder.editText.clearFocus(); 

    if(readOnly){
        holder.editText.setEnabled(false);
    } else {
        holder.editText.setEnabled(true);
    }
    return view;
}
 
源代码10 项目: dhis2-android-datacapture   文件: TextRow.java
@Override
public View getView(View convertView) {
    View view;
    EditTextHolder holder;

    if (convertView == null) {
        ViewGroup rowRoot = (ViewGroup) inflater.inflate(R.layout.listview_row_text, null);
        TextView label = (TextView) rowRoot.findViewById(R.id.text_label);
        EditText editText = (EditText) rowRoot.findViewById(R.id.edit_text_row);

        EditTextWatcher watcher = new EditTextWatcher(field);
        editText.addTextChangedListener(watcher);

        holder = new EditTextHolder(label, editText, watcher);
        rowRoot.setTag(holder);
        view = rowRoot;
    } else {
        view = convertView;
        holder = (EditTextHolder) view.getTag();
    }

    RowCosmetics.setTextLabel(field, holder.textLabel);
    
    holder.textWatcher.setField(field);
    holder.editText.addTextChangedListener(holder.textWatcher);
    holder.editText.setText(field.getValue());
    holder.editText.clearFocus();
    holder.editText.setOnEditorActionListener(mOnEditorActionListener);

    if(readOnly){
        holder.editText.setEnabled(false);
    } else {
        holder.editText.setEnabled(true);
    }
    return view;
}
 
源代码11 项目: JianshuApp   文件: Plugin.java
public void destroy() {
    this.mOnLoadFinishs.clear();

    if (mWebView != null) {
        ViewGroup contentView = (ViewGroup) mWebView.getRootView().findViewById(android.R.id.content);
        contentView.setTag(ID_PLUGIN, null);
        contentView.removeView(mRootLayout);
        mRootLayout.removeView(mWebView);
        mWebView.destroy();
        mRootLayout = null;
        mWebView = null;
    }
}
 
源代码12 项目: dhis2-android-datacapture   文件: IntegerRow.java
@Override
public View getView(View convertView) {
    View view;
    EditTextHolder holder;
    
    if (convertView == null) {
        ViewGroup rowRoot = (ViewGroup) inflater.inflate(R.layout.listview_row_integer, null);
        TextView label = (TextView) rowRoot.findViewById(R.id.text_label);
        EditText editText = (EditText) rowRoot.findViewById(R.id.edit_integer_row);
       
        EditTextWatcher watcher = new EditTextWatcher(field);
        editText.addTextChangedListener(watcher);
        
        holder = new EditTextHolder(label, editText, watcher);
        rowRoot.setTag(holder);
        view = rowRoot;
    } else {
        view = convertView;
        holder = (EditTextHolder) view.getTag();
    }

    RowCosmetics.setTextLabel(field, holder.textLabel);
    
    holder.textWatcher.setField(field);
    holder.editText.addTextChangedListener(holder.textWatcher);
    holder.editText.setText(field.getValue());
    holder.editText.clearFocus();
    holder.editText.setOnEditorActionListener(mOnEditorActionListener);

    if(readOnly){
        holder.editText.setEnabled(false);
    } else {
        holder.editText.setEnabled(true);
    }
    return view;
}
 
源代码13 项目: OmniList   文件: ThemedActivity.java
public void setTranslucentStatusBar() {
    Window window = getWindow();
    ViewGroup mContentView = findViewById(Window.ID_ANDROID_CONTENT);
    // set child View not fill the system window
    View mChildView = mContentView.getChildAt(0);
    if (mChildView != null) {
        mChildView.setFitsSystemWindows(false);
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        int statusBarHeight = ViewUtils.getStatusBarHeight(this);
        // First translucent status bar.
        window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            // After LOLLIPOP just set LayoutParams.
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            window.setStatusBarColor(Color.TRANSPARENT);
            // must call requestApplyInsets, otherwise it will have space in screen bottom
            if (mChildView != null) {
                ViewCompat.requestApplyInsets(mChildView);
            }
        } else {
            ViewGroup mDecorView = (ViewGroup) window.getDecorView();
            if (mDecorView.getTag() != null && mDecorView.getTag() instanceof Boolean && (Boolean)mDecorView.getTag()) {
                mChildView = mDecorView.getChildAt(0);
                // remove fake status bar view.
                mContentView.removeView(mChildView);
                mChildView = mContentView.getChildAt(0);
                if (mChildView != null) {
                    FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mChildView.getLayoutParams();
                    // cancel the margin top
                    if (lp != null && lp.topMargin >= statusBarHeight) {
                        lp.topMargin -= statusBarHeight;
                        mChildView.setLayoutParams(lp);
                    }
                }
                mDecorView.setTag(false);
            }
        }
    }
}
 
@Override
public View getView(final int position, final View convertView, final ViewGroup parent) {
    ViewGroup view = (ViewGroup) convertView;
    ViewHolder viewHolder;

    if (view == null) {
        view = createView(parent);

        viewHolder = new ViewHolder();
        viewHolder.titleParent = (ViewGroup) view.findViewById(mTitleParentResId);
        viewHolder.contentParent = (ViewGroup) view.findViewById(mContentParentResId);

        view.setTag(viewHolder);
    } else {
        viewHolder = (ViewHolder) view.getTag();
    }

    View titleView = getTitleView(position, viewHolder.titleView, viewHolder.titleParent);
    if (titleView != viewHolder.titleView) {
        viewHolder.titleParent.removeAllViews();
        viewHolder.titleParent.addView(titleView);

        if (mActionViewResId == 0) {
            view.setOnClickListener(new TitleViewOnClickListener(viewHolder.contentParent));
        } else {
            view.findViewById(mActionViewResId).setOnClickListener(new TitleViewOnClickListener(viewHolder.contentParent));
        }
    }
    viewHolder.titleView = titleView;

    View contentView = getContentView(position, viewHolder.contentView, viewHolder.contentParent);
    if (contentView != viewHolder.contentView) {
        viewHolder.contentParent.removeAllViews();
        viewHolder.contentParent.addView(contentView);
    }
    viewHolder.contentView = contentView;

    viewHolder.contentParent.setVisibility(mExpandedIds.contains(getItemId(position)) ? View.VISIBLE : View.GONE);
    viewHolder.contentParent.setTag(getItemId(position));

    ViewGroup.LayoutParams layoutParams = viewHolder.contentParent.getLayoutParams();
    layoutParams.height = LayoutParams.WRAP_CONTENT;
    viewHolder.contentParent.setLayoutParams(layoutParams);

    return view;
}
 
源代码15 项目: Camera-Roll-Android-App   文件: ViewHolder.java
ViewGroup inflateVideoView(ViewGroup container) {
    ViewGroup v = ItemViewUtil.inflateVideoView(container);
    v.setTag(albumItem.getPath());
    this.itemView = v;
    return v;
}
 
@Override
public View getView(final int position, final View convertView, final ViewGroup parent) {
    ViewGroup view = (ViewGroup) convertView;
    ViewHolder viewHolder;

    if (view == null) {
        view = createView(parent);

        viewHolder = new ViewHolder();
        viewHolder.titleParent = (ViewGroup) view.findViewById(mTitleParentResId);
        viewHolder.contentParent = (ViewGroup) view.findViewById(mContentParentResId);

        view.setTag(viewHolder);
    } else {
        viewHolder = (ViewHolder) view.getTag();
    }

    View titleView = getTitleView(position, viewHolder.titleView, viewHolder.titleParent);
    if (titleView != viewHolder.titleView) {
        viewHolder.titleParent.removeAllViews();
        viewHolder.titleParent.addView(titleView);

        if (mActionViewResId == 0) {
            view.setOnClickListener(new TitleViewOnClickListener(viewHolder.contentParent));
        } else {
            view.findViewById(mActionViewResId).setOnClickListener(new TitleViewOnClickListener(viewHolder.contentParent));
        }
    }
    viewHolder.titleView = titleView;

    View contentView = getContentView(position, viewHolder.contentView, viewHolder.contentParent);
    if (contentView != viewHolder.contentView) {
        viewHolder.contentParent.removeAllViews();
        viewHolder.contentParent.addView(contentView);
    }
    viewHolder.contentView = contentView;

    viewHolder.contentParent.setVisibility(mExpandedIds.contains(getItemId(position)) ? View.VISIBLE : View.GONE);
    viewHolder.contentParent.setTag(getItemId(position));

    LayoutParams layoutParams = viewHolder.contentParent.getLayoutParams();
    layoutParams.height = LayoutParams.WRAP_CONTENT;
    viewHolder.contentParent.setLayoutParams(layoutParams);

    return view;
}
 
@Override
public View getView(final int position, final View convertView, final ViewGroup parent) {
    ViewGroup view = (ViewGroup) convertView;
    ViewHolder viewHolder;

    if (view == null) {
        view = createView(parent);

        viewHolder = new ViewHolder();
        viewHolder.titleParent = (ViewGroup) view.findViewById(mTitleParentResId);
        viewHolder.contentParent = (ViewGroup) view.findViewById(mContentParentResId);

        view.setTag(viewHolder);
    } else {
        viewHolder = (ViewHolder) view.getTag();
    }

    View titleView = getTitleView(position, viewHolder.titleView, viewHolder.titleParent);
    if (titleView != viewHolder.titleView) {
        viewHolder.titleParent.removeAllViews();
        viewHolder.titleParent.addView(titleView);

        if (mActionViewResId == 0) {
            view.setOnClickListener(new TitleViewOnClickListener(viewHolder.contentParent));
        } else {
            view.findViewById(mActionViewResId).setOnClickListener(new TitleViewOnClickListener(viewHolder.contentParent));
        }
    }
    viewHolder.titleView = titleView;

    View contentView = getContentView(position, viewHolder.contentView, viewHolder.contentParent);
    if (contentView != viewHolder.contentView) {
        viewHolder.contentParent.removeAllViews();
        viewHolder.contentParent.addView(contentView);
    }
    viewHolder.contentView = contentView;

    viewHolder.contentParent.setVisibility(mExpandedIds.contains(getItemId(position)) ? View.VISIBLE : View.GONE);
    viewHolder.contentParent.setTag(getItemId(position));

    LayoutParams layoutParams = viewHolder.contentParent.getLayoutParams();
    layoutParams.height = LayoutParams.WRAP_CONTENT;
    viewHolder.contentParent.setLayoutParams(layoutParams);

    return view;
}
 
@Override
@NonNull
public View getView(final int position, @Nullable final View convertView, @NonNull final ViewGroup parent) {
    ViewGroup view = (ViewGroup) convertView;
    ViewHolder viewHolder;

    if (view == null) {
        view = createView(parent);

        viewHolder = new ViewHolder();
        viewHolder.titleParent = (ViewGroup) view.findViewById(mTitleParentResId);
        viewHolder.contentParent = (ViewGroup) view.findViewById(mContentParentResId);

        view.setTag(viewHolder);
    } else {
        viewHolder = (ViewHolder) view.getTag();
    }

    View titleView = getTitleView(position, viewHolder.titleView, viewHolder.titleParent);
    if (!titleView.equals(viewHolder.titleView)) {
        viewHolder.titleParent.removeAllViews();
        viewHolder.titleParent.addView(titleView);

        if (mActionViewResId == 0) {
            view.setOnClickListener(new TitleViewOnClickListener(viewHolder.contentParent));
        } else {
            view.findViewById(mActionViewResId).setOnClickListener(new TitleViewOnClickListener(viewHolder.contentParent));
        }
    }
    viewHolder.titleView = titleView;

    View contentView = getContentView(position, viewHolder.contentView, viewHolder.contentParent);
    if (!contentView.equals(viewHolder.contentView)) {
        viewHolder.contentParent.removeAllViews();
        viewHolder.contentParent.addView(contentView);
    }
    viewHolder.contentView = contentView;

    viewHolder.contentParent.setVisibility(mExpandedIds.contains(getItemId(position)) ? View.VISIBLE : View.GONE);
    viewHolder.contentParent.setTag(getItemId(position));

    LayoutParams layoutParams = viewHolder.contentParent.getLayoutParams();
    layoutParams.height = LayoutParams.WRAP_CONTENT;
    viewHolder.contentParent.setLayoutParams(layoutParams);

    return view;
}
 
源代码19 项目: LeisureRead   文件: StatusBarCompat.java
/**
 * change to full screen mode
 *
 * @param hideStatusBarBackground hide status bar alpha Background when SDK > 21, true if hide it
 */
public static void translucentStatusBar(Activity activity, boolean hideStatusBarBackground) {

  Window window = activity.getWindow();
  ViewGroup mContentView = (ViewGroup) activity.findViewById(Window.ID_ANDROID_CONTENT);

  //set child View not fill the system window
  View mChildView = mContentView.getChildAt(0);
  if (mChildView != null) {
    ViewCompat.setFitsSystemWindows(mChildView, false);
  }

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    int statusBarHeight = getStatusBarHeight(activity);

    //First translucent status bar.
    window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      //After LOLLIPOP just set LayoutParams.
      window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
      if (hideStatusBarBackground) {
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.setStatusBarColor(COLOR_TRANSLUCENT);
      } else {
        window.setStatusBarColor(calculateStatusBarColor(COLOR_TRANSLUCENT, DEFAULT_COLOR_ALPHA));
      }
      //must call requestApplyInsets, otherwise it will have space in screen bottom
      if (mChildView != null) {
        ViewCompat.requestApplyInsets(mChildView);
      }
    } else {
      ViewGroup mDecorView = (ViewGroup) window.getDecorView();
      if (mDecorView.getTag() != null && mDecorView.getTag() instanceof Boolean &&
          (Boolean) mDecorView.getTag()) {
        mChildView = mDecorView.getChildAt(0);
        //remove fake status bar view.
        mContentView.removeView(mChildView);
        mChildView = mContentView.getChildAt(0);
        if (mChildView != null) {
          FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mChildView.getLayoutParams();
          //cancel the margin top
          if (lp != null && lp.topMargin >= statusBarHeight) {
            lp.topMargin -= statusBarHeight;
            mChildView.setLayoutParams(lp);
          }
        }
        mDecorView.setTag(false);
      }
    }
  }
}
 
源代码20 项目: dhis2-android-datacapture   文件: GenderRow.java
@Override
public View getView(View convertView) {
	View view;
	BooleanRowHolder holder;

	if (convertView == null) {
		ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.listview_row_gender, null);
		TextView label = (TextView) rootView.findViewById(R.id.text_label);

		MaleButtonListener mListener = new MaleButtonListener(field);
		FemaleButtonListener fListener = new FemaleButtonListener(field);
		OtherButtonListener oListener = new OtherButtonListener(field);

		CompoundButton mButton = (CompoundButton) rootView.findViewById(R.id.option_male);
		CompoundButton fButton = (CompoundButton) rootView.findViewById(R.id.option_female);
		CompoundButton oButton = (CompoundButton) rootView.findViewById(R.id.option_other);

		mButton.setOnCheckedChangeListener(mListener);
		fButton.setOnCheckedChangeListener(fListener);
		oButton.setOnCheckedChangeListener(oListener);

		holder = new BooleanRowHolder(label, mListener, fListener, oListener, mButton, fButton,
				oButton);

		rootView.setTag(holder);
		view = rootView;
	} else {
		view = convertView;
		holder = (BooleanRowHolder) convertView.getTag();
	}

	RowCosmetics.setTextLabel(field, holder.textLabel);

	holder.optionMaleListener.setField(field);
	holder.optionFemaleListener.setField(field);
	holder.optionOtherListener.setField(field);

	holder.optionMale.setOnCheckedChangeListener(holder.optionMaleListener);
	holder.optionFemale.setOnCheckedChangeListener(holder.optionFemaleListener);
	holder.optionOther.setOnCheckedChangeListener(holder.optionOtherListener);

	if (field.getValue().equals(MALE))
		holder.optionMale.setChecked(true);
	else if (field.getValue().equals(FEMALE))
		holder.optionFemale.setChecked(true);
	else if (field.getValue().equals(OTHER))
		holder.optionOther.setChecked(true);

	if(readOnly){
		holder.optionOther.setEnabled(false);
		holder.optionFemale.setEnabled(false);
		holder.optionMale.setEnabled(false);
	} else {
		holder.optionOther.setEnabled(true);
		holder.optionFemale.setEnabled(true);
		holder.optionMale.setEnabled(true);
	}
	return view;
}
 
源代码评论
动弹
沙发等你来抢
 方法所在类