本文整理汇总了Java中android.view.View.setVisibility方法的典型用法代码示例。如果您正苦于以下问题:Java View.setVisibility方法的具体用法?Java View.setVisibility怎么用?Java View.setVisibility使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.setVisibility方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showHideViewById
import android.view.View; //导入方法依赖的package包/类
/**
* 根据ID显示隐藏布局
* @param id
*/
private void showHideViewById(int id) {
for (int i = 0; i < layoutSparseArray.size(); i++) {
int key = layoutSparseArray.keyAt(i);
View valueView = layoutSparseArray.valueAt(i);
//显示该view
if(key == id) {
valueView.setVisibility(View.VISIBLE);
if(mStatusLayoutManager.onShowHideViewListener != null) mStatusLayoutManager.onShowHideViewListener.onShowView(valueView, key);
} else {
if(valueView.getVisibility() != View.GONE) {
valueView.setVisibility(View.GONE);
if(mStatusLayoutManager.onShowHideViewListener != null) mStatusLayoutManager.onShowHideViewListener.onHideView(valueView, key);
}
}
}
}
示例2: showAnimation
import android.view.View; //导入方法依赖的package包/类
private void showAnimation(ViewGroup layout){
for(int i=0;i<layout.getChildCount();i++){
final View child = layout.getChildAt(i);
if(child.getId() == R.id.popmenu_close){
continue;
}
child.setOnClickListener(this);
child.setVisibility(View.INVISIBLE);
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
child.setVisibility(View.VISIBLE);
ValueAnimator fadeAnim = ObjectAnimator.ofFloat(child, "translationY", 600, 0);
fadeAnim.setDuration(300);
KickBackAnimator kickAnimator = new KickBackAnimator();
kickAnimator.setDuration(150);
fadeAnim.setEvaluator(kickAnimator);
fadeAnim.start();
}
}, i * 50);
}
}
示例3: onBindDialogView
import android.view.View; //导入方法依赖的package包/类
@Override
protected void onBindDialogView(View view) {
super.onBindDialogView(view);
this.datePicker = (DatePicker) view.findViewById(R.id.datePicker);
//Remover o date_picker_header do datePicker se o mesmo existir
View viewDayDatePicker = datePicker.findViewById(Resources.getSystem().getIdentifier("date_picker_header", "id", "android"));
if (viewDayDatePicker != null) {
viewDayDatePicker.setVisibility(View.GONE);
}
Calendar calendar = Calendar.getInstance();
try {
//recuperar a preferência no formato yyyyMMdd e converter para um Calendar:
calendar = OhaHelper.getCalendar(this.getPersistedString(OhaHelper.getStrDate(new Date())));
} catch (ParseException e) {
e.printStackTrace();
}
datePicker.init(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), null);
}
示例4: layoutChildItems
import android.view.View; //导入方法依赖的package包/类
private void layoutChildItems() {
int count = getChildCount();
double baseAngle = (Math.PI - mItemAngleSection) / 2;
for (int i = 1; i < count; i++) {
View child = getChildAt(i);
int cWidth = child.getMeasuredWidth();
int cHeight = child.getMeasuredHeight();
int l = (int) (getMeasuredWidth() / 2 - mRadius * Math.cos(mItemAngleSection / count * i + baseAngle) - cWidth / 2);
int t = (int) (getMeasuredHeight() - (mRadius * Math.sin(mItemAngleSection / count * i + baseAngle) - mPointOffetScreenY)
- mMarginBottom);
child.layout(l, t, l + cWidth, t + cHeight);
child.setVisibility(View.GONE);
}
}
示例5: visible
import android.view.View; //导入方法依赖的package包/类
protected void visible(final View... views) {
if (views != null && views.length > 0) {
for (View view : views) {
if (view != null) {
view.setVisibility(View.VISIBLE);
}
}
}
}
示例6: noMoreLoading
import android.view.View; //导入方法依赖的package包/类
public void noMoreLoading() {
isLoadingData = false;
final View footView = mFootViews.get(0);
isnomore = true;
if (footView instanceof LoadingMoreFooter) {
((LoadingMoreFooter) footView).setState(LoadingMoreFooter.STATE_NOMORE);
} else {
footView.setVisibility(View.GONE);
}
// 额外添加的footView
if (isOther) {
footView.setVisibility(View.VISIBLE);
}
}
示例7: fadeIn
import android.view.View; //导入方法依赖的package包/类
static void fadeIn(View view, int duration) {
Animation anim = new AlphaAnimation(0.0f, 1.0f);
anim.setInterpolator(new AccelerateDecelerateInterpolator());
anim.setDuration(duration);
view.setAnimation(anim);
view.setVisibility(View.VISIBLE);
}
示例8: addStatusBarColor
import android.view.View; //导入方法依赖的package包/类
private static void addStatusBarColor(final Activity activity, final int color, final int alpha, boolean isDecor) {
ViewGroup parent = isDecor ?
(ViewGroup) activity.getWindow().getDecorView() :
(ViewGroup) activity.findViewById(android.R.id.content);
View fakeStatusBarView = parent.findViewWithTag(TAG_COLOR);
if (fakeStatusBarView != null) {
if (fakeStatusBarView.getVisibility() == View.GONE) {
fakeStatusBarView.setVisibility(View.VISIBLE);
}
fakeStatusBarView.setBackgroundColor(getStatusBarColor(color, alpha));
} else {
parent.addView(createColorStatusBarView(parent.getContext(), color, alpha));
}
}
示例9: initViews
import android.view.View; //导入方法依赖的package包/类
private void initViews() {
mFingerprintImageView = (View) findViewById(R.id.fingerprint_image);
if (isFingerPrintLockEnabled) {
mFingerprintImageView.setVisibility(View.VISIBLE);
}
else {
mFingerprintImageView.setVisibility(View.GONE);
}
mPatternLockView = (PatternLockView) findViewById(R.id.pattern_lock_view);
}
示例10: scaleShow
import android.view.View; //导入方法依赖的package包/类
public static void scaleShow(View view, ViewPropertyAnimatorListener viewPropertyAnimatorListener) {
view.setVisibility(View.VISIBLE);
ViewCompat.animate(view)
.scaleX(1.0f)
.scaleY(1.0f)
.alpha(1.0f)
.setDuration(800)
.setListener(viewPropertyAnimatorListener)
.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR)
.start();
}
示例11: changeBindViewVisibility
import android.view.View; //导入方法依赖的package包/类
/**
* 更改绑定布局的显示状态
*
* @param visible 显示的状态
*/
private void changeBindViewVisibility(int visible) {
final View[] views = mBindViews;
if (views == null || views.length == 0)
return;
for (View view : views) {
view.setVisibility(visible);
}
}
示例12: setCategories
import android.view.View; //导入方法依赖的package包/类
public void setCategories(SparseArray<SpeciesCategory> categories, SparseIntArray categoryData) {
LinearLayout categoriesView = (LinearLayout) findViewById(R.id.categories);
categoriesView.removeAllViews();
for (int i = 0; i < SpeciesInformation.getSpeciesCategories().size() && i < DISPLAY_CATEGORIES; i++) {
CatchCategoryItem item = new CatchCategoryItem(mContext);
SpeciesCategory speciesCategory = categories.get(categories.keyAt(i));
item.setContents(categoryData.get(speciesCategory.mId), speciesCategory.mName);
item.setLayoutParams(new CatchCategoryItem.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1f));
if (i < DISPLAY_CATEGORIES - 1) {
View separator = item.findViewById(R.id.divider);
separator.setVisibility(View.VISIBLE);
}
categoriesView.addView(item);
}
}
示例13: calcAndRefreshStickTopView
import android.view.View; //导入方法依赖的package包/类
protected void calcAndRefreshStickTopView() {
Collections.sort(listStickTop, new Comparator<ForumForum>() {
@Override
public int compare(ForumForum lhs, ForumForum rhs) {
return new Long(lhs.fid - rhs.fid).intValue();
}
});
//Reuse the view created last time.
for (int i = 0; i < listStickTop.size(); i++) {
View viewchild = layoutSticktop.getChildAt(i);
View view = createSticktopItem(listStickTop.get(i), viewchild, layoutSticktop);
view.setVisibility(VISIBLE);
if(viewchild == null) {
layoutSticktop.addView(view);
}
}
int childcount = layoutSticktop.getChildCount();
if(childcount > listStickTop.size()) {
for(int i = listStickTop.size(); i < childcount; i++) {
layoutSticktop.getChildAt(i).setVisibility(GONE);
}
}
if (layoutSticktop.getChildCount() == 0) {
layoutSticktop.setVisibility(View.GONE);
} else {
layoutSticktop.setVisibility(VISIBLE);
}
}
示例14: setupStatusBarView
import android.view.View; //导入方法依赖的package包/类
private void setupStatusBarView(Context context, ViewGroup decorViewGroup) {
mStatusBarTintView = new View(context);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, mConfig.getStatusBarHeight());
params.gravity = Gravity.TOP;
if (mNavBarAvailable && !mConfig.isNavigationAtBottom()) {
params.rightMargin = mConfig.getNavigationBarWidth();
}
mStatusBarTintView.setLayoutParams(params);
mStatusBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR);
mStatusBarTintView.setVisibility(View.GONE);
decorViewGroup.addView(mStatusBarTintView);
}
示例15: updateField
import android.view.View; //导入方法依赖的package包/类
private void updateField(TextView v, CharSequence text, View label) {
boolean hasText = !TextUtils.isEmpty(text);
v.setText(text);
v.setVisibility(hasText ? View.VISIBLE : View.GONE);
label.setVisibility(hasText ? View.VISIBLE : View.GONE);
}