本文整理汇总了Java中android.widget.CheckBox.setVisibility方法的典型用法代码示例。如果您正苦于以下问题:Java CheckBox.setVisibility方法的具体用法?Java CheckBox.setVisibility怎么用?Java CheckBox.setVisibility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.CheckBox
的用法示例。
在下文中一共展示了CheckBox.setVisibility方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initViews
import android.widget.CheckBox; //导入方法依赖的package包/类
private void initViews() {
listContacts = (ListView) findViewById(R.id.chat_sdk_list_contacts);
txtSearch = (TextView) findViewById(R.id.chat_sdk_et_search);
imgSearch = (ImageView) findViewById(R.id.chat_sdk_search_image);
btnStartChat = (Button) findViewById(R.id.chat_sdk_btn_add_contacts);
chSelectAll = (CheckBox) findViewById(R.id.chat_sdk_chk_select_all);
if (mode == MODE_ADD_TO_CONVERSATION)
btnStartChat.setText(getResources().getString(R.string.add_users));
if (!BDefines.Options.GroupEnabled)
{
btnStartChat.setVisibility(View.GONE);
chSelectAll.setVisibility(View.GONE);
}
}
示例2: refreshDisplay
import android.widget.CheckBox; //导入方法依赖的package包/类
private void refreshDisplay() {
TextView brightnessText = (TextView) findViewById(R.id.brightness);
brightnessText.setText(getString(R.string.brightness) + " "
+ getBrightness() + "%");
SeekBar slider = (SeekBar) findViewById(R.id.slider);
slider.setProgress(getBrightness());
// Show/Hide the auto brightness check box.
CheckBox checkbox = (CheckBox) findViewById(R.id.auto_brightness);
if (Util.supportsAutoBrightness(getContentResolver())) {
checkbox.setVisibility(View.VISIBLE);
if (Util.getAutoBrightnessEnabled(getContentResolver())) {
checkbox.setChecked(true);
lockBrightnessControls(true);
} else {
checkbox.setChecked(false);
lockBrightnessControls(false);
}
} else {
checkbox.setVisibility(View.GONE);
lockBrightnessControls(false);
}
}
示例3: 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;
}
示例4: DataViewHolder
import android.widget.CheckBox; //导入方法依赖的package包/类
DataViewHolder(View itemView) {
super(itemView);
textView = (TextView) itemView.findViewById(tv);
imageView = (ImageView) itemView.findViewById(R.id.iv);
checkBox = (CheckBox) itemView.findViewById(R.id.cb);
if (checkBoxEnabled) {
checkBox.setVisibility(View.VISIBLE);
checkBox.setOnClickListener(this);
}
else
{
checkBox.setVisibility(View.GONE);
}
}
示例5: showCheckBox
import android.widget.CheckBox; //导入方法依赖的package包/类
/**
* 是否显示多选按钮
*
* @describe
*/
private void showCheckBox(CheckBox checkBox, int position) {
if (NoteListConstans.isShowMultiSelectAction) {
checkBox.setVisibility(View.VISIBLE);
if (mCheckList.get(position))
checkBox.setChecked(true);
else
checkBox.setChecked(false);
} else {
checkBox.setVisibility(View.INVISIBLE);
checkBox.setChecked(false);
}
}
示例6: getItemView
import android.widget.CheckBox; //导入方法依赖的package包/类
public View getItemView(final int position, View convertView, ViewHolder holder) {
CustomCookItem cook = (CustomCookItem) getItem(position);
if (cook != null) {
ImageView civIcon = (CircleImageView) holder.getView(R.id.civ_icon);
if (!TextUtils.isEmpty(cook.photo)) {
String imgUrl;
if (cook.photo.contains(TimeLinePatterns.WEB_SCHEME)) {
imgUrl = cook.photo;
} else {
imgUrl = TimeLinePatterns.WEB_SCHEME + cook.photo;
}
ImageLoader.getInstance().displayImage(imgUrl, civIcon, ImageLoaderOptions.global
((int) R.drawable.aa2));
}
((TextView) holder.getView(R.id.tv_name)).setText(cook.name);
((TextView) holder.getView(R.id.tv_calory)).setText(String.format("%.1f 千卡/份", new
Object[]{Float.valueOf(cook.calory)}));
CheckBox cbSelect = (CheckBox) holder.getView(R.id.cb_select);
if (this.isEdit) {
cbSelect.setVisibility(0);
cbSelect.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (position < CustomCookAdapter.this.mDataSelect.size()) {
CustomCookAdapter.this.mDataSelect.set(position, Boolean.valueOf
(isChecked));
}
}
});
} else {
cbSelect.setVisibility(8);
}
cbSelect.setChecked(((Boolean) this.mDataSelect.get(position)).booleanValue());
}
return convertView;
}
示例7: getItemView
import android.widget.CheckBox; //导入方法依赖的package包/类
public View getItemView(final int position, View convertView, ViewHolder holder) {
CustomFood food = (CustomFood) getItem(position);
if (food != null) {
ImageLoader.getInstance().displayImage(food.image_url, (CircleImageView) holder
.getView(R.id.civ_icon), ImageLoaderOptions.global((int) R.drawable.aa2));
((TextView) holder.getView(R.id.tv_name)).setText(food.food_name);
((TextView) holder.getView(R.id.tv_calory)).setText(FoodUtils.showUnitValue(food
.calory, false));
((TextView) holder.getView(R.id.tv_unit)).setText(String.format(" 千卡/%1$s%2$s", new
Object[]{food.amount, food.unit_name}));
CheckBox cbSelect = (CheckBox) holder.getView(R.id.cb_select);
if (this.isEdit) {
cbSelect.setVisibility(0);
cbSelect.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (position < CustomFoodAdapter.this.mDataSelect.size()) {
CustomFoodAdapter.this.mDataSelect.set(position, Boolean.valueOf
(isChecked));
}
}
});
} else {
cbSelect.setVisibility(8);
}
cbSelect.setChecked(((Boolean) this.mDataSelect.get(position)).booleanValue());
}
return convertView;
}
示例8: getItemView
import android.widget.CheckBox; //导入方法依赖的package包/类
public View getItemView(final int position, View convertView, ViewHolder holder) {
CollectionFood food = (CollectionFood) getItem(position);
if (food != null) {
ImageView civIcon = (CircleImageView) holder.getView(R.id.civ_icon);
if (!TextUtils.isEmpty(food.thumb_image_url)) {
ImageLoader.getInstance().displayImage(food.thumb_image_url, civIcon,
ImageLoaderOptions.global((int) R.drawable.aa2));
}
((TextView) holder.getView(R.id.tv_name)).setText(food.name);
((TextView) holder.getView(R.id.tv_calory)).setText(FoodUtils.showUnitValue(food
.calory, false));
((TextView) holder.getView(R.id.tv_unit)).setText(FoodUtils.changeUnitAndWeight(food
.weight, food.is_liquid, false));
ImageView ivLight = (ImageView) holder.getView(R.id.iv_light);
FoodUtils.switchToLight(food.health_light, ivLight);
CheckBox cbSelect = (CheckBox) holder.getView(R.id.cb_select);
if (this.isEdit) {
cbSelect.setVisibility(0);
ivLight.setVisibility(8);
cbSelect.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (position < CollectionAdapter.this.mDataSelect.size()) {
CollectionAdapter.this.mDataSelect.set(position, Boolean.valueOf
(isChecked));
}
}
});
} else {
cbSelect.setVisibility(8);
ivLight.setVisibility(0);
}
cbSelect.setChecked(((Boolean) this.mDataSelect.get(position)).booleanValue());
}
return convertView;
}
示例9: prepareUI
import android.widget.CheckBox; //导入方法依赖的package包/类
private void prepareUI(String shareUri) {
mSharePathEditText = (EditText) findViewById(R.id.share_path);
mUsernameEditText = (EditText) findViewById(R.id.username);
mDomainEditText = (EditText) findViewById(R.id.domain);
mPasswordEditText = (EditText) findViewById(R.id.password);
CheckBox passwordCheckbox = (CheckBox) findViewById(R.id.needs_password);
mPinShareCheckbox = (CheckBox) findViewById(R.id.pin_share);
mSharePathEditText.setText(shareUri);
mSharePathEditText.setEnabled(false);
passwordCheckbox.setVisibility(View.GONE);
mPinShareCheckbox.setVisibility(View.VISIBLE);
Button mLoginButton = (Button) findViewById(R.id.mount);
mLoginButton.setText(getResources().getString(R.string.login));
mLoginButton.setOnClickListener(mLoginListener);
final Button cancel = (Button) findViewById(R.id.cancel);
cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
}
示例10: init
import android.widget.CheckBox; //导入方法依赖的package包/类
@SuppressLint("InflateParams")
public void init(int _position) {
// 获取需要翻译的条目所在位置
position = _position;
LayoutInflater factory = LayoutInflater.from(mContext);
// 得到自定义对话框
View DialogView = factory.inflate(R.layout.translate, null);
// 创建对话框
new AlertDialog.Builder(mContext).setView(DialogView)// 设置自定义对话框的样式
.setTitle(R.string.translate) // 设置进度条对话框的标题
.setNegativeButton(R.string.translate, new DialogInterface.OnClickListener() // 设置按钮,并监听
{
@SuppressWarnings("unchecked")
@Override
public void onClick(DialogInterface p1, int p2) {
// 开启一个翻译线程
new translate_task().execute(source_list, target_list);
}
}).create()// 创建
.show(); // 显示对话框
// 找到显示源语言的Spinner控件
src_type = (Spinner) DialogView.findViewById(R.id.src_type);
// 找到显示目标语言的Spinner控件
translate_to = (Spinner) DialogView.findViewById(R.id.translate_to);
// 找到翻译商的选项的Spinner控件
translator = (Spinner) DialogView.findViewById(R.id.translator);
// 找到显示跳过选项的CheckBox控件
skip_already_translate = (CheckBox) DialogView.findViewById(R.id.skip_already_translate);
// 源语言默认自动识别
src_type.setSelection(0);
// 翻译为默认选择中文
translate_to.setSelection(1);
// 默认选择百度翻译
translator.setSelection(0);
// 如果是翻译单个条目,需要隐藏“跳过已翻译的内容”的选项,否则需要显示该选项
skip_already_translate.setVisibility(translate_all ? View.VISIBLE : View.GONE);
skip_already_translate.setOnCheckedChangeListener(this);
}
示例11: ViewHolder
import android.widget.CheckBox; //导入方法依赖的package包/类
ViewHolder(View rowView, Model model, int position) {
Context context = getContext();
this.rowView = rowView;
this.model = model;
rowView.setTag(this);
// title
TextView titleView = (TextView) rowView.findViewById(R.id.text_title);
if (titleView != null) {
titleView.setText(model.title);
}
// comment
if (model.comment != null) {
TextView commentView = (TextView) rowView.findViewById(R.id.text_comment);
if (commentView != null) {
commentView.setText(model.comment);
commentView.setVisibility(View.VISIBLE);
}
}
// checkbox
if (model.type == Model.CHECKBOX) {
checkBox = (CheckBox) rowView.findViewById(R.id.cb);
if (checkBox != null) {
Utils.scaleViewOnTablet(context, checkBox, R.dimen.iconScale);
checkBox.setVisibility(View.VISIBLE);
checkBox.setChecked(model.isChecked());
checkBox.setOnClickListener(listener);
}
} else {
checkBox = null;
}
// button
if (model.type == Model.BUTTON) {
rowView.setOnClickListener(listener);
// set row's background drawable
int drawableRes = Utils.getResourceId(context, R.attr.selector_control);
Utils.setDrawable(context, rowView, drawableRes);
// set row's image
ImageView imageView = (ImageView) rowView.findViewById(R.id.image);
if (imageView != null) {
Utils.scaleViewOnTablet(context, imageView, R.dimen.iconScale);
imageView.setVisibility(View.VISIBLE);
}
}
// title
if (model.type == Model.TITLE) {
if (position == 0) {
View borderView = rowView.findViewById(R.id.top_border);
if (borderView != null) {
borderView.setVisibility(View.GONE);
}
}
}
}
示例12: onCreate
import android.widget.CheckBox; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_audio_streaming);
mRole = getIntent().getIntExtra("role", QiniuAppServer.RTC_ROLE_VICE_ANCHOR);
mRoomName = getIntent().getStringExtra("roomName");
boolean isSwCodec = getIntent().getBooleanExtra("swcodec", true);
boolean isLandscape = getIntent().getBooleanExtra("orientation", false);
setRequestedOrientation(isLandscape ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
mControlButton = (Button) findViewById(R.id.ControlButton);
mStatusTextView = (TextView) findViewById(R.id.StatusTextView);
mStatTextView = (TextView) findViewById(R.id.StatTextView);
mMuteCheckBox = (CheckBox) findViewById(R.id.MuteCheckBox);
mMuteCheckBox.setOnClickListener(mMuteButtonClickListener);
mConferenceCheckBox = (CheckBox) findViewById(R.id.ConferenceCheckBox);
mConferenceCheckBox.setOnClickListener(mConferenceButtonClickListener);
if (mRole == QiniuAppServer.RTC_ROLE_ANCHOR) {
mConferenceCheckBox.setVisibility(View.VISIBLE);
}
AVCodecType codecType = isSwCodec ? AVCodecType.SW_AUDIO_CODEC : AVCodecType.HW_AUDIO_CODEC;
mRTCStreamingManager = new RTCMediaStreamingManager(getApplicationContext(), codecType);
mRTCStreamingManager.setConferenceStateListener(mRTCStreamingStateChangedListener);
mRTCStreamingManager.setUserEventListener(mRTCUserEventListener);
mRTCStreamingManager.setDebugLoggingEnabled(false);
RTCConferenceOptions options = new RTCConferenceOptions();
options.setHWCodecEnabled(!isSwCodec);
mRTCStreamingManager.setConferenceOptions(options);
MicrophoneStreamingSetting setting = new MicrophoneStreamingSetting();
setting.setBluetoothSCOEnabled(false);
setting.setAudioSource(MediaRecorder.AudioSource.VOICE_COMMUNICATION);
// the anchor must configure the `StreamingProfile`
if (mRole == QiniuAppServer.RTC_ROLE_ANCHOR) {
mRTCStreamingManager.setStreamStatusCallback(mStreamStatusCallback);
mRTCStreamingManager.setStreamingStateListener(mStreamingStateChangedListener);
mRTCStreamingManager.setStreamingSessionListener(mStreamingSessionListener);
mStreamingProfile = new StreamingProfile();
mStreamingProfile.setAudioQuality(StreamingProfile.AUDIO_QUALITY_MEDIUM2)
.setEncoderRCMode(StreamingProfile.EncoderRCModes.QUALITY_PRIORITY);
mRTCStreamingManager.prepare(setting, mStreamingProfile);
} else {
/**
* The RTCVideoWindow is used to show the anchor's video
* This code is not required when the anchor is publishing audio streaming only.
*/
RTCVideoWindow remoteAnchorView = new RTCVideoWindow((RTCSurfaceView) findViewById(R.id.RemoteAnchorView));
mRTCStreamingManager.addRemoteWindow(remoteAnchorView);
mControlButton.setText("开始连麦");
mRTCStreamingManager.prepare(setting);
}
mProgressDialog = new ProgressDialog(this);
}
示例13: onCreate
import android.widget.CheckBox; //导入方法依赖的package包/类
protected void onCreate(Bundle arg0) {
int i;
int i2 = 0;
super.onCreate(arg0);
setContentView(R.layout.device_id);
((TextView) findViewById(R.id.device_id)).setText(Global.DEVICEID);
findViewById(R.id.device_back_btn).setOnClickListener(new OnClickListener(this) {
final /* synthetic */ DeviceIdActivity this$0;
{
if (HotFix.PREVENT_VERIFY) {
System.out.println(VerifyLoad.class);
}
this.this$0 = this$0;
}
public void onClick(View v) {
this.this$0.finish();
}
});
((TextView) findViewById(R.id.pcode)).setText(Global.PCODE);
((TextView) findViewById(R.id.appkey)).setText(LetvConfig.getAppKey());
this.mSpinner = (Spinner) findViewById(R.id.spinner);
this.mSpinner.setVisibility(LetvConfig.isDebug() ? 0 : 8);
this.mUseDPCheckBox = (CheckBox) findViewById(R.id.use_double_player);
CheckBox checkBox = this.mUseDPCheckBox;
if (LetvConfig.isDebug()) {
i = 0;
} else {
i = 8;
}
checkBox.setVisibility(i);
this.mUseEndlessRecyclerCBox = (CheckBox) findViewById(R.id.use_endless_recyclerview);
CheckBox checkBox2 = this.mUseEndlessRecyclerCBox;
if (!LetvConfig.isDebug()) {
i2 = 8;
}
checkBox2.setVisibility(i2);
initTestButton();
refreshRadioState();
setSpinner();
initDP();
}
示例14: getView
import android.widget.CheckBox; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null)
convertView = liInflater.inflate(R.layout.row_session_list, null);
final Models.DisplaySession session = (Models.DisplaySession)getItem(position);
TextView tvTime = (TextView)convertView.findViewById(R.id.tvTime);
TextView tvTitle = (TextView)convertView.findViewById(R.id.tvTitle);
TextView tvSubtitle = (TextView)convertView.findViewById(R.id.tvSubtitle);
final CheckBox cbShown = (CheckBox)convertView.findViewById(R.id.cbShown);
// Set checkbox state
cbShown.setOnCheckedChangeListener(null);
cbShown.setChecked(session.visible);
cbShown.setVisibility(View.GONE);
if (fragment.getEditMode() == true)
cbShown.setVisibility(View.VISIBLE);
// Set text
tvTime.setText(session.start);
tvTitle.setText(session.getTitle());
tvSubtitle.setText(session.getSubtitle());
// Set text colour
Context context = fragment.getContext();
HashMap<Models.TimeState, Integer> colourMap = new HashMap<>();
colourMap.put(Models.TimeState.Elapsed, ContextCompat.getColor(context, R.color.colorTextDisabled));
colourMap.put(Models.TimeState.Ongoing, ContextCompat.getColor(context, R.color.colorPrimary));
colourMap.put(Models.TimeState.Future, ContextCompat.getColor(context, R.color.colorTextBlack));
for (TextView tv : new TextView[] { tvTime, tvTitle, tvSubtitle })
tv.setTextColor(colourMap.get(session.getState()));
// Add event for checkbox clicked
cbShown.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
// Update this session
session.visible = cbShown.isChecked();
// Notify fragment that this session has been updated
fragment.updateSession(session);
}
});
return convertView;
}
示例15: onCheckedChanged
import android.widget.CheckBox; //导入方法依赖的package包/类
public void onCheckedChanged(RadioGroup radiogroup, int checkedId) {
LinearLayout manualSettings = (LinearLayout) getActivity().findViewById(R.id.fragment_settings_manual_settings);
EditText nextUpdate = (EditText) getActivity().findViewById(R.id.fragment_settings_next_update);
TextView gpsAcc = (TextView) getActivity().findViewById(R.id.fragment_settings_gps_accuracy);
CheckBox saveAndEdit = (CheckBox) getActivity().findViewById(R.id.fragment_settings_save_and_edit);
if (manualSettings == null) {
return;
}
switch (checkedId) {
case R.id.fragment_settings_treetracker:
manualSettings.setVisibility(View.GONE);
saveAndEdit.setVisibility(View.GONE);
nextUpdate.setEnabled(false);
gpsAcc.setVisibility(View.VISIBLE);
int accServer = mSharedPreferences.getInt(ValueHelper.MAIN_DB_MIN_ACCURACY, ValueHelper.MIN_ACCURACY_DEFAULT_SETTING);
int nextUpdateServer = mSharedPreferences.getInt(ValueHelper.MAIN_DB_NEXT_UPDATE, ValueHelper.TIME_TO_NEXT_UPDATE_DEFAULT_SETTING);
nextUpdate.setText(Integer.toString(accServer));
gpsAcc.setText(Integer.toString(nextUpdateServer) + " " + getActivity().getResources().getString(R.string.meters));
break;
case R.id.fragment_settings_manual:
manualSettings.setVisibility(View.VISIBLE);
saveAndEdit.setVisibility(View.VISIBLE);
nextUpdate.setEnabled(true);
gpsAcc.setVisibility(View.INVISIBLE);
nextUpdate.setText(Integer.toString(mSharedPreferences.getInt(
ValueHelper.TIME_TO_NEXT_UPDATE_ADMIN_DB_SETTING, mSharedPreferences.getInt(
ValueHelper.TIME_TO_NEXT_UPDATE_GLOBAL_SETTING,
ValueHelper.TIME_TO_NEXT_UPDATE_DEFAULT_SETTING))));
gpsAcc.setText(Integer.toString(mSharedPreferences.getInt(ValueHelper.MIN_ACCURACY_GLOBAL_SETTING,
ValueHelper.MIN_ACCURACY_DEFAULT_SETTING)) + " " + getActivity().getResources().getString(R.string.meters));
break;
default:
break;
}
}