当前位置: 首页>>代码示例>>Java>>正文


Java ViewGroup.post方法代码示例

本文整理汇总了Java中android.view.ViewGroup.post方法的典型用法代码示例。如果您正苦于以下问题:Java ViewGroup.post方法的具体用法?Java ViewGroup.post怎么用?Java ViewGroup.post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.ViewGroup的用法示例。


在下文中一共展示了ViewGroup.post方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setStatusBar

import android.view.ViewGroup; //导入方法依赖的package包/类
/**
     * 设置沉浸式状态栏
     */
    protected void setStatusBar() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            final ViewGroup linear_bar = (ViewGroup) findViewById(R.id.title_layout);
            final int statusHeight = getStatusBarHeight();
            linear_bar.post(new Runnable() {
                @Override
                public void run() {
//                    int titleHeight = linear_bar.getHeight();
                    Log.d("gaolei","titleHeight--------"+titleHeight);
                    Log.d("gaolei","statusHeight--------"+statusHeight);
                    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) linear_bar.getLayoutParams();
                    params.height = statusHeight + titleHeight;
                    linear_bar.setLayoutParams(params);
                }
            });
        }
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:BaseActivity.java

示例2: setStatus

import android.view.ViewGroup; //导入方法依赖的package包/类
/**
 * 系统版本4.4或以上才可以设置沉浸式状态栏
 *
 * 设置状态栏的高度
 */
protected void setStatus(){
    bar_layout= (ViewGroup) findViewById(R.id.bar_layout);
    if (Build.VERSION.SDK_INT >=Build.VERSION_CODES.KITKAT){
        //设置状态栏透明
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        //设置导航栏透明
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        final int statusBarHeight = getStatusBarHeight();
        bar_layout.post(new Runnable() {
            @Override
            public void run() {
                //标题栏高度
                int height=bar_layout.getHeight();
                android.widget.RelativeLayout.LayoutParams params = (android.widget.RelativeLayout.LayoutParams) bar_layout.getLayoutParams();
                //导航栏高度+通知栏高度
                params.height=height+statusBarHeight;
                bar_layout.setLayoutParams(params);
            }
        });
    }
}
 
开发者ID:guzhigang001,项目名称:Bailan,代码行数:27,代码来源:BaseActivity.java

示例3: changeSettingButton

import android.view.ViewGroup; //导入方法依赖的package包/类
void changeSettingButton(final boolean isRev) {
  final String overflowDesc = getString(R.string.accessibility_overflow);

  final ViewGroup decor = (ViewGroup) getWindow().getDecorView();

  decor.post(new Runnable() {
    @Override
    public void run() {
      final ArrayList<View> outViews = new ArrayList<>();

      decor.findViewsWithText(outViews, overflowDesc, View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION);

      if (outViews.isEmpty()) {
        return;
      }

      ImageView overflow = (ImageView) outViews.get(0);
      if (isRev) {
        overflow.setImageResource(R.mipmap.ic_setting_rev);
      } else {
        overflow.setImageResource(R.mipmap.ic_setting);
      }
    }
  });
}
 
开发者ID:tkrworks,项目名称:JinsMemeBRIDGE-Android,代码行数:26,代码来源:MainActivity.java

示例4: onFinishInflate

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
protected void onFinishInflate() {
    super.onFinishInflate();

    if(getChildCount() > 0) {
        if(getChildAt(0) instanceof ViewGroup) {
            ViewGroup childLayout = (ViewGroup) getChildAt(0);
            childLayout.post(new Runnable() {
                @Override
                public void run() {
                    updateCover();
                }
            });

            if(childLayout.getChildCount() > 0) {
                childLayout.getChildAt(0).post(new Runnable() {
                    @Override
                    public void run() {
                        updateCover();
                    }
                });
            }
        }
    }
    updateCover();
}
 
开发者ID:battleent,项目名称:android-RibbonViews,代码行数:27,代码来源:RibbonFickleCoverLayout.java

示例5: showSticky

import android.view.ViewGroup; //导入方法依赖的package包/类
/**
 * Pop stickyView to stack
 */
private void showSticky() {
  WXCell headComponent = headComponentStack.pop();
  headComponentStack.push(headComponent);
  final View headerView = headComponent.getRealView();
  if (headerView == null)
    return;
  headerViewStack.push(headerView);
  headComponent.removeSticky();
  final ViewGroup parent = (ViewGroup) getParent();
  if(parent != null){
    parent.post(WXThread.secure(new Runnable() {
      @Override
      public void run() {
        ViewGroup existedParent;
        if((existedParent = (ViewGroup)headerView.getParent())!= null){
          existedParent.removeView(headerView);
        }
        parent.addView(headerView);
      }
    }));
  }
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:26,代码来源:BounceRecyclerView.java

示例6: removeSticky

import android.view.ViewGroup; //导入方法依赖的package包/类
/**
 * remove top stickyView
 * @param component
 */
private void removeSticky(WXComponent component) {
  final WXCell headComponent = headComponentStack.pop();
  if (!component.getRef().equals(headComponent.getRef())) {
    headComponentStack.push(headComponent);
    return;
  }
  final View headerView = headerViewStack.pop();
  final ViewGroup parent = (ViewGroup) getParent();
  if(parent != null){
    parent.post(WXThread.secure(new Runnable() {
      @Override
      public void run() {
        parent.removeView(headerView);
        headComponent.recoverySticky();
      }
    }));
  }

}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:24,代码来源:BounceRecyclerView.java

示例7: setStatusBarLayout

import android.view.ViewGroup; //导入方法依赖的package包/类
protected void setStatusBarLayout() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        final ViewGroup linear_bar = (ViewGroup) findViewById(R.id.title_layout);
        final int statusHeight = getStatusBarHeight();
        linear_bar.post(new Runnable() {
            @Override
            public void run() {
                RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) linear_bar.getLayoutParams();
                params.height = statusHeight ;
                linear_bar.setLayoutParams(params);
            }
        });
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:BaseActivity.java

示例8: initViewWithId

import android.view.ViewGroup; //导入方法依赖的package包/类
private void initViewWithId(Context context) {
    mContext = context;

    LayoutInflater inflater =
            (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    inflater.inflate(R.layout.tag_root, this);

    mRoot = (ViewGroup) findViewById(R.id.tag_root);
    mTagImageView = (TagImageView) findViewById(R.id.tag_image_view);

    setLayoutParamsToBeSetForRootLayout(mContext);
    mRoot.post(mSetRootHeightWidth);
    mRoot.setOnTouchListener(mTagOnTouchListener);
    mGestureDetector = new GestureDetector(mRoot.getContext(), mTagGestureListener);
}
 
开发者ID:harsh159357,项目名称:InstaTag,代码行数:16,代码来源:InstaTag.java

示例9: removeCling

import android.view.ViewGroup; //导入方法依赖的package包/类
private void removeCling(int id) {
    setPagingEnabled(true);
    clingActive = false;

    final View cling = findViewById(id);
    if(cling != null) {
        final ViewGroup parent = (ViewGroup) cling.getParent();
        parent.post(new Runnable() {
            @Override
            public void run() {
                parent.removeView(cling);
            }
        });
    }
}
 
开发者ID:gigabytedevelopers,项目名称:CalcMate,代码行数:16,代码来源:Calculator.java


注:本文中的android.view.ViewGroup.post方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。