本文整理汇总了Java中android.widget.CompoundButton.setTag方法的典型用法代码示例。如果您正苦于以下问题:Java CompoundButton.setTag方法的具体用法?Java CompoundButton.setTag怎么用?Java CompoundButton.setTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.CompoundButton
的用法示例。
在下文中一共展示了CompoundButton.setTag方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setConditionItem
import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void setConditionItem(NewConditionItem item) {
mRoot = item;
mList.removeAllViews();
LayoutInflater inflater = LayoutInflater.from(getContext());
for (NewConditionItem subItem : mRoot.subItems) {
CompoundButton cb = (CompoundButton) inflater.inflate(
R.layout.item_condition_1, mList, false);
cb.setTag(subItem);
cb.setText(subItem.name);
cb.setChecked(subItem.selected);
cb.setOnClickListener(this);
mList.addView(cb);
if (subItem != mRoot.subItems.get(mRoot.subItems.size() - 1)) {
inflater.inflate(R.layout.layout_condition_divider, mList);
}
}
}
示例2: setConditionItem
import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void setConditionItem(NewConditionItem item) {
mRoot = item;
mTvTitle.setText(item.name);
mGrid.removeAllViews();
for (NewConditionItem subItem : mRoot.subItems) {
if (subItem.type != NewConditionItem.TYPE_LIST) {
if (subItem.type == NewConditionItem.TYPE_DATA) {
this.item = (DateSelectConditionItem) subItem;
DataSelectContainer container2 = new DataSelectContainer(getContext());
LinearLayout.LayoutParams lp2 = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
);
container2.setLayoutParams(lp2);
container2.setTag(subItem);
container2.setConditionItem(subItem);
addFooterView(container2);
}
continue;
}
btn = (CompoundButton) LayoutInflater.from(getContext())
.inflate(R.layout.item_condition_grid, mGrid, false);
btn.setTag(subItem);
btn.setText(subItem.name);
btn.setChecked(subItem.selected);
btn.setOnCheckedChangeListener(this);
addToGrid(btn);
}
}
示例3: onBindViewHolder
import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RegionContainer.VH holder, final int position) {
final NewConditionItem item = mList.get(position);
if (holder.getItemViewType() == TYPE_EDIT) {
CompoundButton btnEdit = holder.tb;
btnEdit.setText(item.name);
btnEdit.setChecked(item.selected);
btnEdit.setTag(item);
btnEdit.setId(holder.getItemViewType());
btnEdit.setOnClickListener(mOnClickListener);
final View finalView = btnEdit;
final NewConditionItem finalitem =item;
btnEdit.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mOnItemClickListener!= null) {
mOnItemClickListener.onEditClick(finalView, item.id);
}
}
});
} else {
CompoundButton btn = holder.tb;
btn.setText(item.name);
btn.setChecked(item.selected);
btn.setTag(item);
btn.setId(holder.getItemViewType());
btn.setOnClickListener(mOnClickListener);
}
}
示例4: refreshSearchEngineViews
import android.widget.CompoundButton; //导入方法依赖的package包/类
private void refreshSearchEngineViews(Context context, SearchEngineManager sem) {
if (searchEngineGroup == null) {
// We want to refresh the search engine list of this preference in onResume,
// but the first time this preference is created onResume is called before onCreateView
// so searchEngineGroup is not set yet.
return;
}
final String defaultSearchEngine = sem.getDefaultSearchEngine(context).getIdentifier();
searchEngineGroup.removeAllViews();
final LayoutInflater layoutInflater = LayoutInflater.from(context);
final RecyclerView.LayoutParams layoutParams = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
for (int i = 0; i < searchEngines.size(); i++) {
final SearchEngine engine = searchEngines.get(i);
final String engineId = engine.getIdentifier();
final CompoundButton engineItem = makeButtonFromSearchEngine(engine, layoutInflater, context.getResources());
engineItem.setId(i);
engineItem.setTag(engineId);
if (engineId.equals(defaultSearchEngine)) {
updateDefaultItem(engineItem);
}
searchEngineGroup.addView(engineItem, layoutParams);
}
}