设置可见和不可见 即 设置 显示和隐藏;是双向设置;什么情况显示,什么情况隐藏分判断的条件
它不同于删除和屏蔽,删除和屏蔽,覆盖是单向的,不可逆转的。它间接等于单向的隐藏!!!
XML:android:visibility="gone"
android:layout_width="0dp"
android:layout_height="0dp"
Activity:当前活动
NetWorkShowView.this.setVisibility(View.VISIBLE);
NetWorkShowView.this.setVisibility(View.INVISIBLE);
NetWorkShowView.this.setVisibility(View.GONE);
View:视图
view.setVisibility(View.VISIBLE);
view.setVisibility(View.INVISIBLE);
view.setVisibility(View.GONE);
Button:按钮
Button.setVisibility(View.VISIBLE);
Button.setVisibility(View.INVISIBLE);
Button.setVisibility(View.GONE);
Item:控件
ItemView:
ListItem:
itemView.setVisibility(View.VISIBLE);
itemView.setVisibility(View.INVISIBLE);
itemView.setVisibility(View.GONE);
mItem.setVisibility(View.VISIBLE);
mItem.setVisibility(View.INVISIBLE);
mItem.setVisibility(View.GONE);
Preference:页面
mPreference.setVisible(false);
mPreference.setVisible(true);
MenuItem:菜单控件:
MenuItem more = menu.add(0, 1, 0, "输入");
more.setVisible(true);
more.setVisible(false);
menu.add(0, MENU_TAKE_VIDEO, 0, R.string.attach_record_video).setVisible(true);
menu.add(0, MENU_TAKE_VIDEO, 0, R.string.attach_record_video).setVisible(false);
例如:短信
int camValue = android.provider.Settings.System.getInt(getContentResolver(),"tyd_disable_camera", 0);
menu.add(0, MENU_TAKE_VIDEO, 0, R.string.attach_record_video).setIcon(R.drawable.ic_menu_movie).setVisible(camValue != 1);
例如:图库
int camValue = Settings.System.getInt(mActivity.getAndroidContext().getContentResolver(),"tyd_disable_camera", 0);
menu .findItem(R.id.action_camera).setVisible(camValue != 1);