本文整理汇总了Java中android.widget.CheckBox.setTag方法的典型用法代码示例。如果您正苦于以下问题:Java CheckBox.setTag方法的具体用法?Java CheckBox.setTag怎么用?Java CheckBox.setTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.CheckBox
的用法示例。
在下文中一共展示了CheckBox.setTag方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindView
import android.widget.CheckBox; //导入方法依赖的package包/类
@Override
public void bindView(View view, Context context, Cursor cursor) {
Log.w("bind view", String.valueOf(selectedItemsPositions.size()));
CheckBox box = (CheckBox) view.findViewById(R.id.checkboxAddLessonToGroup);
box.setTag(cursor.getPosition());
Log.w("cursor getPosition", String.valueOf(cursor.getPosition()));
Log.w("selectedItemsPositions", selectedItemsPositions.toString());
// if selected checkbox id are stored, so select checkbox
if (selectedItemsPositions.containsKey(cursor.getPosition()))
box.setChecked(true);
else
// ... or unselect
box.setChecked(false);
//Find fields to populate in inflated template
TextView lessonToSelectTitle = (TextView) view.findViewById(R.id.lessonToSelectTitle);
// Extract properties from cursor
String lessonToSelectTitleString = cursor.getString(cursor.getColumnIndexOrThrow("title"));
lessonToSelectTitle.setText(lessonToSelectTitleString);
}
示例2: getItemView
import android.widget.CheckBox; //导入方法依赖的package包/类
public View getItemView(int position, View convertView, ViewHolder holder) {
WeightPhoto photo = (WeightPhoto) getItem(position);
CheckBox cbSelect = (CheckBox) holder.getView(R.id.cb_select);
cbSelect.setTag(photo);
cbSelect.setChecked(this.mSelect.contains(photo));
cbSelect.setOnCheckedChangeListener(this);
cbSelect.setVisibility(this.isSelect ? 0 : 8);
View content = holder.getView(R.id.view_content);
content.setTag(photo);
content.setOnClickListener(this);
ImageView imageView = (ImageView) holder.getView(R.id.iv_photo);
TextView tvWeight = (TextView) holder.getView(R.id.tv_weight);
TextView tvTime = (TextView) holder.getView(R.id.tv_time);
LayoutParams layoutParams = imageView.getLayoutParams();
LayoutParams layoutParams2 = imageView.getLayoutParams();
int i = this.mWidth;
layoutParams2.height = i;
layoutParams.width = i;
this.imageLoader.displayImage(photo.thumb_photo_url, imageView);
tvWeight.setText(String.valueOf(photo.weight) + "公斤");
tvTime.setText(DateHelper.formatString(photo.record_on, "yyyy年M月d日"));
return convertView;
}
示例3: setFile
import android.widget.CheckBox; //导入方法依赖的package包/类
@Override
public void setFile(File_POJO file) {
super.setFile(file);
CheckBox checkBox = itemView.findViewById(R.id.checkbox);
checkBox.setTag(file.getPath());
setOnCheckedChangeListener(null);
checkBox.setChecked(file.excluded);
ArrayList<String> excludedPaths = Provider.getExcludedPaths();
boolean enabled = !Provider.isDirExcludedBecauseParentDirIsExcluded(
file.getPath(), excludedPaths);
checkBox.setEnabled(enabled);
}
示例4: getView
import android.widget.CheckBox; //导入方法依赖的package包/类
/**
* @brief Returns the view clicked in the list
* @param position
* @param convertView
* @param parent
* @return view
* @details Returns the view clicked in the list, put the connection name, the ip, and the
* icon star
*/
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View vi=convertView;
if(convertView == null) {
LayoutInflater inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
vi = inflater.inflate(R.layout.element_user, null);
}
final Connection user = getList().get(position);
final CheckBox iconFav = (CheckBox)vi.findViewById(R.id.checkFav);
iconFav.setTag(user);
iconFav.setOnCheckedChangeListener(
new CheckBox.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
if (isChecked){
iconFav.setButtonDrawable(R.drawable.star_ful);
user.setFav(true);
}
else {
iconFav.setButtonDrawable(R.drawable.star_emp);
user.setFav(false);
}
listFragment.refreshFavorites(user);
}
});
//para mantener el estado cuando rota
if (user.isFav()){
iconFav.setButtonDrawable(R.drawable.star_ful);
iconFav.setChecked(true);
}
else{
iconFav.setButtonDrawable(R.drawable.star_emp);
}
TextView name = (TextView) vi.findViewById(R.id.nameConnection);
name.setText(user.getName());
TextView ip_view = (TextView) vi.findViewById(R.id.descIP);
ip_view.setText(user.getIP());
CheckBox iconConnect = (CheckBox)vi.findViewById(R.id.checkConnect);
iconConnect.setTag(user);
return vi;
}
示例5: onCreate
import android.widget.CheckBox; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_file_list);
TitleBar _titleBar = (TitleBar) findViewById(R.id.titleBar);
_text_path = (EditText) findViewById(R.id.edittext_path);
RecyclerView _list = (RecyclerView) findViewById(R.id.recyclerview);
_buttonbar = (LinearLayout) findViewById(R.id.linearlayout_buttonbar);
View _button_delete = findViewById(R.id.textView_delete);
View _button_clean = findViewById(R.id.textView_clean);
View _button_hold = findViewById(R.id.textView_hold);
View _button_close = findViewById(R.id.imageview_close);
_checkbox_all = (CheckBox) findViewById(R.id.checkbox_all);
if (Global.get_rootFile() == null) {
FileManager.reset();
finish();
return;
}
_titleBar.setTitle(R.string.caption_text_mine);
_basic_path = Global.get_rootFile().get_path();
_text_path.setText(Global.get_rootFile().get_path().replace(_basic_path, getString(R.string.str_path_rootFile)));
_layoutManager = new LinearLayoutManager(this);
_layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
_list.setLayoutManager(_layoutManager);
_adapter = new FileListAdapter(this, this);
_adapter.set_data(Global.get_rootFile());
_list.setAdapter(_adapter);
_list.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
_broadcastManager = LocalBroadcastManager.getInstance(getApplicationContext());
_button_delete.setTag(new String[]{ACTION_DELETE});
_button_clean.setTag(new String[]{ACTION_CLEAN});
_button_hold.setTag(new String[]{ACTION_HOLD});
_checkbox_all.setTag(new String[]{ACTION_CHECK});
_button_close.setTag(new String[]{ACTION_CLOSE});
_button_delete.setOnClickListener(this);
_button_clean.setOnClickListener(this);
_button_hold.setOnClickListener(this);
_checkbox_all.setOnClickListener(this);
_button_close.setOnClickListener(this);
}