本文整理汇总了Java中android.widget.CheckBox.setFocusable方法的典型用法代码示例。如果您正苦于以下问题:Java CheckBox.setFocusable方法的具体用法?Java CheckBox.setFocusable怎么用?Java CheckBox.setFocusable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.CheckBox
的用法示例。
在下文中一共展示了CheckBox.setFocusable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getView
import android.widget.CheckBox; //导入方法依赖的package包/类
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
if (row == null) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = inflater.inflate(resourceId, null);
}
final EDFileChooserItem item = items.get(position);
if (item != null) {
CheckBox box = (CheckBox)row
.findViewById(R.id.file_chooser_item_checked);
box.setFocusable(false);
box.setFocusableInTouchMode(false);
box.setOnCheckedChangeListener(null);
box.setChecked(item.isChecked());
box.setOnCheckedChangeListener(new CheckboxChangeListener(item));
TextView fileName = (TextView) row
.findViewById(R.id.file_chooser_item_name);
ImageView fileIcon = (ImageView) row
.findViewById(R.id.file_chooser_item_icon);
TextView fileSize = (TextView) row
.findViewById(R.id.file_chooser_item_size);
if (fileName != null) {
fileName.setText(item.getName());
}
if (fileSize != null) {
if (!item.isDirectory()) {
fileSize.setText(humanReadableByteCount(item.getSize(),
false));
} else {
fileSize.setText(null);
}
}
if (fileIcon != null) {
// if (item.isDirectory()) {
// fileIcon.setImageResource(R.drawable.ic_folder);
// } else {
// String[] types = {"apk","avi","doc","docx","flv","gif","gz","htm","html","jpg","mp3","mpg","pdf","png","txt","xls","zip","mp4"};
// boolean found = false;
// for (String type: types){
// int resource = context.getResources().getIdentifier("mime_"+type, "drawable", context.getPackageName());
// if (item.getName().toLowerCase().endsWith(type)) {
// fileIcon.setImageResource(resource);
// found=true;
// }
// }
// if (!found) fileIcon.setImageResource(R.drawable.ic_file);
// }
fileIcon.setImageBitmap(item.getIcon());
}
}
return row;
}