本文整理匯總了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;
}