本文整理汇总了Java中android.widget.ImageButton.getVisibility方法的典型用法代码示例。如果您正苦于以下问题:Java ImageButton.getVisibility方法的具体用法?Java ImageButton.getVisibility怎么用?Java ImageButton.getVisibility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ImageButton
的用法示例。
在下文中一共展示了ImageButton.getVisibility方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onClick
import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
final View deleteView = v;
final ImageButton deleteButton = v.findViewById(R.id.deleteButton);
if (deleteButton.getVisibility() == View.VISIBLE) {
deleteView.setBackgroundColor(Color.TRANSPARENT);
deleteButton.setVisibility(View.INVISIBLE);
} else {
deleteView.setBackgroundColor(Color.RED);
deleteButton.setVisibility(View.VISIBLE);
deleteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (view == deleteButton) {
Toast.makeText(getApplicationContext(), "Will be deleted", Toast.LENGTH_SHORT).show();
deleteButton.setVisibility(View.INVISIBLE);
deleteView.setBackgroundColor(Color.TRANSPARENT);
}
}
});
}
}
示例2: run
import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
public void run() {
DragAdapter.isShowAdd = false;
for (int i = 0; i < getChildCount(); i++) {
final View mGridItemView = getChildAt(i);
mDeleteButton = (ImageButton) mGridItemView
.findViewById(R.id.ic_close);
// mDeleteButton.setOnClickListener(DragGridView.this);
if (mDeleteButton.getVisibility() != View.VISIBLE) {
mDeleteButton.setVisibility(View.VISIBLE);
}
if (mNeedShake) {
mStartShake = true;
shakeAnimation(mGridItemView);
}
}
}
示例3: onFinishInflate
import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
public void onFinishInflate() {
super.onFinishInflate();
mLocationBar = (LocationBarTablet) findViewById(R.id.location_bar);
mHomeButton = (TintedImageButton) findViewById(R.id.home_button);
mBackButton = (TintedImageButton) findViewById(R.id.back_button);
mForwardButton = (TintedImageButton) findViewById(R.id.forward_button);
mReloadButton = (TintedImageButton) findViewById(R.id.refresh_button);
mShowTabStack = DeviceClassManager.isAccessibilityModeEnabled(getContext())
|| CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_TABLET_TAB_STACK);
mTabSwitcherButtonDrawable =
TabSwitcherDrawable.createTabSwitcherDrawable(getResources(), false);
mTabSwitcherButtonDrawableLight =
TabSwitcherDrawable.createTabSwitcherDrawable(getResources(), true);
mAccessibilitySwitcherButton = (ImageButton) findViewById(R.id.tab_switcher_button);
mAccessibilitySwitcherButton.setImageDrawable(mTabSwitcherButtonDrawable);
updateSwitcherButtonVisibility(mShowTabStack);
mBookmarkButton = (TintedImageButton) findViewById(R.id.bookmark_button);
mMenuButton = (TintedImageButton) findViewById(R.id.menu_button);
mMenuButtonWrapper.setVisibility(View.VISIBLE);
if (mAccessibilitySwitcherButton.getVisibility() == View.GONE
&& mMenuButtonWrapper.getVisibility() == View.GONE) {
ApiCompatibilityUtils.setPaddingRelative((View) mMenuButtonWrapper.getParent(), 0, 0,
getResources().getDimensionPixelSize(R.dimen.tablet_toolbar_end_padding), 0);
}
mSaveOfflineButton = (TintedImageButton) findViewById(R.id.save_offline_button);
// Initialize values needed for showing/hiding toolbar buttons when the activity size
// changes.
mShouldAnimateButtonVisibilityChange = false;
mToolbarButtonsVisible = true;
mToolbarButtons = new TintedImageButton[] {mBackButton, mForwardButton, mReloadButton};
}