本文整理汇总了Java中android.widget.ToggleButton.setVisibility方法的典型用法代码示例。如果您正苦于以下问题:Java ToggleButton.setVisibility方法的具体用法?Java ToggleButton.setVisibility怎么用?Java ToggleButton.setVisibility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ToggleButton
的用法示例。
在下文中一共展示了ToggleButton.setVisibility方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initViews
import android.widget.ToggleButton; //导入方法依赖的package包/类
@Override
protected void initViews(View view) {
super.initViews(view);
timerChronometer = (Chronometer) view.findViewById(com.mobilemaster.quickblox.groupchatwebrtc.R.id.chronometer_timer_audio_call);
ImageView firstOpponentAvatarImageView = (ImageView) view.findViewById(com.mobilemaster.quickblox.groupchatwebrtc.R.id.image_caller_avatar);
firstOpponentAvatarImageView.setBackgroundDrawable(UiUtils.getColorCircleDrawable(opponents.get(0).getId()));
alsoOnCallText = (TextView) view.findViewById(com.mobilemaster.quickblox.groupchatwebrtc.R.id.text_also_on_call);
setVisibilityAlsoOnCallTextView();
firstOpponentNameTextView = (TextView) view.findViewById(com.mobilemaster.quickblox.groupchatwebrtc.R.id.text_caller_name);
firstOpponentNameTextView.setText(opponents.get(0).getFullName());
otherOpponentsTextView = (TextView) view.findViewById(com.mobilemaster.quickblox.groupchatwebrtc.R.id.text_other_inc_users);
otherOpponentsTextView.setText(getOtherOpponentsNames());
audioSwitchToggleButton = (ToggleButton) view.findViewById(com.mobilemaster.quickblox.groupchatwebrtc.R.id.toggle_speaker);
audioSwitchToggleButton.setVisibility(View.VISIBLE);
actionButtonsEnabled(false);
}
示例2: onCreateView
import android.widget.ToggleButton; //导入方法依赖的package包/类
@SuppressLint("NewApi")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final View rootView = inflater.inflate(R.layout.fragment_map, container, false);
logTextView = (TextView) rootView.findViewById(R.id.textView1);
final File filesDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
fileMap = new File(filesDirectory, FILE_MAP);
Utils.loadAd(rootView);
setHasOptionsMenu(true);
setupWebView(rootView);
setupNmeaClientService();
startStopButton = (ToggleButton) rootView.findViewById(R.id.startStopAisButton);
startStopButton.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
startReceivingAisFromAntenna();
} else {
stopReceivingAisFromAntenna();
}
}
});
// TODO: Not possible to stop. Will start automatically when valid PPM exists and hide (stop) button for now
startStopButton.setVisibility(View.GONE);
return rootView;
}
示例3: getView
import android.widget.ToggleButton; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.sensor_list_item, parent, false);
LinearLayout itemLayout = (LinearLayout) rowView.findViewById(R.id.item_layout);
ImageView itemImageView = (ImageView) rowView.findViewById(R.id.item_image);
TextView itemNameView = (TextView) rowView.findViewById(R.id.item_name);
TextView itemStatus = (TextView) rowView.findViewById(R.id.item_status);
ToggleButton itemEnable = (ToggleButton) rowView.findViewById(R.id.item_enable);
ToggleButton itemActivate = (ToggleButton) rowView.findViewById(R.id.item_activate);
Button itemActuatorRun = (Button) rowView.findViewById(R.id.item_actuator_run);
itemActuatorRun.setVisibility(View.GONE);
final SensorInfo sensorInfo = sensorInfos.get(position);
itemImageView.setImageResource(sensorInfo.getType().getImage());
itemNameView.setText(sensorInfo.getType().getNickname());
itemEnable.setChecked(sensorInfo.isEnable());
if (sensorInfo.getType().getCategory() == SensorType.Category.ACTUATOR) {
itemStatus.setVisibility(View.GONE);
itemActivate.setVisibility(View.GONE);
}
else {
itemActivate.setEnabled(false);
itemStatus.setText(sensorInfo.toString());
itemActivate.setChecked(sensorInfo.isActivated());
}
// sensor item click
itemLayout.setTag(sensorInfo);
itemLayout.setOnClickListener(listItemClickListener);
// sensor enable button click
itemEnable.setTag(sensorInfo);
itemEnable.setOnClickListener(enableClickListener);
return rowView;
}
示例4: initViews
import android.widget.ToggleButton; //导入方法依赖的package包/类
@Override
protected void initViews(View view) {
super.initViews(view);
Log.i(TAG, "initViews");
opponentViewHolders = new SparseArray<>(opponents.size());
isRemoteShown = false;
isCurrentCameraFront = true;
localVideoView = (QBRTCSurfaceView) view.findViewById(R.id.local_video_view);
initCorrectSizeForLocalView();
localVideoView.setZOrderMediaOverlay(true);
remoteFullScreenVideoView = (QBRTCSurfaceView) view.findViewById(R.id.remote_video_view);
remoteFullScreenVideoView.setOnClickListener(localViewOnClickListener);
if (!isPeerToPeerCall) {
recyclerView = (RecyclerView) view.findViewById(R.id.grid_opponents);
recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), R.dimen.grid_item_divider));
recyclerView.setHasFixedSize(true);
final int columnsCount = defineColumnsCount();
LinearLayoutManager layoutManager
= new LinearLayoutManager(getActivity(), HORIZONTAL, false);
recyclerView.setLayoutManager(layoutManager);
// for correct removing item in adapter
recyclerView.setItemAnimator(null);
recyclerView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
setGrid(columnsCount);
recyclerView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
}
});
}
connectionStatusLocal = (TextView) view.findViewById(R.id.connectionStatusLocal);
cameraToggle = (ToggleButton) view.findViewById(R.id.toggle_camera);
cameraToggle.setVisibility(View.VISIBLE);
actionVideoButtonsLayout = (LinearLayout) view.findViewById(R.id.element_set_video_buttons);
actionButtonsEnabled(false);
restoreSession();
}
示例5: getItemView
import android.widget.ToggleButton; //导入方法依赖的package包/类
public View getItemView(int position, View convertView, ViewHolder holder) {
Boolean isEdit = CartActivity.isEdit;
CartGoods goods = (CartGoods) this.goodsList.get(position);
RelativeLayout rl_title = (RelativeLayout) holder.getView(R.id.rl_title);
LinearLayout ll_edit = (LinearLayout) holder.getView(R.id.ll_edit);
TextView tv_goods_state = (TextView) holder.getView(R.id.tv_goods_state);
ToggleButton checkBox = (ToggleButton) holder.getView(R.id.tb_cart);
ImageView iv_goods = (ImageView) holder.getView(R.id.iv_goods);
TextView tv_goods_title = (TextView) holder.getView(R.id.tv_goods_title);
TextView tv_price_value = (TextView) holder.getView(R.id.tv_price_value);
Button btn_decrease = (Button) holder.getView(R.id.btn_decrease);
Button btn_increase = (Button) holder.getView(R.id.btn_increase);
TextView tv_goods_num = (TextView) holder.getView(R.id.tv_goods_num);
checkBox.setChecked(goods.isChecked.booleanValue());
this.loader.displayImage(goods.thumb_photo_url, iv_goods, this.options);
if (TextUtils.equals(goods_type.SpecGoods.name(), goods.type)) {
tv_goods_title.setText(goods.title);
} else {
tv_goods_title.setText(goods.title + ShopUtils.getFormatInfo(goods.chosen_specs));
}
tv_price_value.setText(this.ctx.getString(R.string.a04) + " " + this.ctx.getString(R
.string.ae4) + TextUtil.m2(goods.base_price));
tv_goods_num.setText(String.valueOf(goods.quantity));
btn_decrease.setOnClickListener(new onCreaseClickListener(tv_goods_num, btn_decrease,
goods));
btn_increase.setOnClickListener(new onCreaseClickListener(tv_goods_num, btn_increase,
goods));
if (goods.quantity > 1) {
btn_decrease.setEnabled(true);
btn_decrease.setBackgroundResource(R.drawable.ij);
} else {
btn_decrease.setEnabled(false);
}
if (isEdit.booleanValue()) {
checkBox.setVisibility(0);
btn_decrease.setVisibility(8);
btn_increase.setVisibility(8);
} else {
checkBox.setVisibility(8);
btn_decrease.setVisibility(0);
btn_increase.setVisibility(0);
}
if (goods.can_sale) {
tv_price_value.setVisibility(0);
tv_goods_state.setVisibility(8);
ll_edit.setVisibility(0);
rl_title.setAlpha(1.0f);
} else {
if (!TextUtils.isEmpty(goods.msg)) {
tv_goods_state.setText(goods.msg);
}
tv_price_value.setVisibility(8);
tv_goods_state.setVisibility(0);
ll_edit.setVisibility(8);
rl_title.setAlpha(0.5f);
}
return convertView;
}
示例6: getView
import android.widget.ToggleButton; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.sensor_list_item, parent, false);
LinearLayout itemLayout = (LinearLayout) rowView.findViewById(R.id.item_layout);
ImageView itemImageView = (ImageView) rowView.findViewById(R.id.item_image);
TextView itemNameView = (TextView) rowView.findViewById(R.id.item_name);
TextView itemStatus = (TextView) rowView.findViewById(R.id.item_status);
ToggleButton itemEnable = (ToggleButton) rowView.findViewById(R.id.item_enable);
ToggleButton itemActivate = (ToggleButton) rowView.findViewById(R.id.item_activate);
Button itemActuatorRun = (Button) rowView.findViewById(R.id.item_actuator_run);
itemEnable.setVisibility(View.GONE);
SensorInfo sensorInfo = sensorInfos.get(position);
itemImageView.setImageResource(sensorInfo.getType().getImage());
itemNameView.setText(sensorInfo.getType().getNickname());
// itemEnable.setChecked(sensorInfo.isEnable());
if (sensorInfo.getType().getCategory() == SensorType.Category.ACTUATOR) {
itemStatus.setVisibility(View.GONE);
itemActivate.setVisibility(View.GONE);
itemActuatorRun.setEnabled(sensorInfo.isActivated() && !sensorInfo.isSuspend());
}
else {
itemActuatorRun.setVisibility(View.GONE);
itemStatus.setText(sensorInfo.toString());
itemActivate.setChecked(sensorInfo.isActivated());
itemActivate.setEnabled(!sensorInfo.isSuspend());
}
// sensor item click
itemLayout.setTag(sensorInfo);
itemLayout.setOnClickListener(listItemClickListener);
// sensor activation button click
itemActivate.setTag(sensorInfo);
itemActivate.setOnClickListener(activateClickListener);
// actuator run button click
itemActuatorRun.setTag(sensorInfo);
itemActuatorRun.setOnClickListener(actuatorRunClickListener);
return rowView;
}
示例7: onCreate
import android.widget.ToggleButton; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.barcode_scan_layout);
mScanner = CameraScanner.getInstance();
mDefaultScanCursorView = (DefaultScanCursorView) findViewById(R.id.barcode_scan_cursorview);
mBarcodeScanView = (BarcodeScanView) findViewById(R.id.barcode_scan_scanview);
mBarcodeScanView.setScanCursorView(mDefaultScanCursorView);
mBarcodeScanView.setOnErrorListener(mOnErrorListener);
mBarcodeScanView.setOnPreparedListener(mOnPreparedListener);
mBarcodeScanView.setDecodeResultListener(mResultListener);
mArticleTx = (TextView) findViewById(R.id.title);
mArticleTx.setText(R.string.title_barcode);
mArticleTx.setTextColor(getResources().getColor(R.color.white));
View v = findViewById(R.id.back);
v.setBackgroundResource(R.drawable.barcode_back_bg);
v.setOnClickListener(mOnClickListener);
findViewById(R.id.title_left_button_line).setVisibility(View.GONE);
mAlbumBtn = (TextView) findViewById(R.id.title_right_button);
mAlbumBtn.setText(R.string.album);
mAlbumBtn.setVisibility(View.VISIBLE);
mAlbumBtn.setOnClickListener(mOnClickListener);
mAlbumBtn
.setTextColor(getResources().getColorStateList(R.color.barcode_album_btn_selector));
mTitleBar = findViewById(R.id.title_bar);
mTitleBar.setBackgroundResource(R.drawable.barcode_scan_select_picture_bg_normal);
mFlashLightBtn = (ToggleButton) findViewById(R.id.barcode_scan_flashlight_btn);
mFlashLightBtn.setVisibility(View.GONE);
mCollapsibleView = (CollapsibleView) findViewById(R.id.barcode_scan_unfoldableview);
mCollapsibleView.setAboveBitmap(R.drawable.barcode_logo_top_half,
R.drawable.barcode_logo_bottom_half);
mCollapsibleView.setBelowBitmap(R.drawable.barcode_logo_bottom_half,
R.drawable.barcode_logo_top_half);
findViewById(R.id.barcode_scan_flashlight_btn).setOnClickListener(mOnClickListener);//这三句是为了有系统按键音
// Request Camera permission
if (ContextCompat.checkSelfPermission(BarcodeScanActivity.this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
requestedCameraPermission = false;
ActivityCompat.requestPermissions(BarcodeScanActivity.this, new String[]{
Manifest.permission.CAMERA
}, MY_PERMISSIONS_REQUEST_CAMERA);
} else {
requestedCameraPermission = true;
}
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
registerReceiver(mScreenStateBroadReceiver, intentFilter);
}
示例8: getView
import android.widget.ToggleButton; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.sensor_list_item, parent, false);
LinearLayout itemLayout = (LinearLayout) rowView.findViewById(R.id.item_layout);
ImageView itemImageView = (ImageView) rowView.findViewById(R.id.item_image);
TextView itemNameView = (TextView) rowView.findViewById(R.id.item_name);
TextView itemStatus = (TextView) rowView.findViewById(R.id.item_status);
ToggleButton itemEnable = (ToggleButton) rowView.findViewById(R.id.item_enable);
ToggleButton itemActivate = (ToggleButton) rowView.findViewById(R.id.item_activate);
Button itemActuatorRun = (Button) rowView.findViewById(R.id.item_actuator_run);
itemEnable.setVisibility(View.GONE);
SensorInfo sensorInfo = sensorInfos.get(position);
itemImageView.setImageResource(sensorInfo.getType().getImage());
itemNameView.setText(sensorInfo.getType().getNickname());
// itemEnable.setChecked(sensorInfo.isEnable());
if (sensorInfo.getType().getCategory() == SensorType.Category.ACTUATOR) {
itemStatus.setVisibility(View.GONE);
itemActivate.setVisibility(View.GONE);
itemActuatorRun.setEnabled(!sensorInfo.isControlling()); // && !sensorInfo.isSuspend());
}
else {
itemActuatorRun.setVisibility(View.GONE);
itemStatus.setText(sensorInfo.toString());
itemActivate.setChecked(sensorInfo.isActivated());
itemActivate.setEnabled(!sensorInfo.isControlling()); // !sensorInfo.isSuspend());
}
// sensor item click
itemLayout.setTag(sensorInfo);
itemLayout.setOnClickListener(listItemClickListener);
// sensor activation button click
itemActivate.setTag(sensorInfo);
itemActivate.setOnClickListener(activateClickListener);
// actuator run button click
itemActuatorRun.setTag(sensorInfo);
itemActuatorRun.setOnClickListener(actuatorRunClickListener);
return rowView;
}