com.google.android.material.appbar.AppBarLayout.getLayoutParams()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中com.google.android.material.appbar.AppBarLayout.getLayoutParams()方法的一些代码示例,展示了AppBarLayout.getLayoutParams()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AppBarLayout.getLayoutParams()方法的具体详情如下:
包路径:com.google.android.material.appbar.AppBarLayout
类名称:AppBarLayout
方法名:getLayoutParams

AppBarLayout.getLayoutParams介绍

暂无

代码示例

代码示例来源:origin: niorgai/StatusBarCompat

CoordinatorLayout.Behavior behavior = ((CoordinatorLayout.LayoutParams) appBarLayout.getLayoutParams()).getBehavior();
if (behavior != null && behavior instanceof AppBarLayout.Behavior) {
  int verticalOffset = ((AppBarLayout.Behavior) behavior).getTopAndBottomOffset();

代码示例来源:origin: niorgai/StatusBarCompat

final View statusView = addFakeStatusBarView(activity, statusColor, statusBarHeight);
CoordinatorLayout.Behavior behavior = ((CoordinatorLayout.LayoutParams) appBarLayout.getLayoutParams()).getBehavior();
if (behavior != null && behavior instanceof AppBarLayout.Behavior) {
  int verticalOffset = ((AppBarLayout.Behavior) behavior).getTopAndBottomOffset();

代码示例来源:origin: klinker24/Android-DragDismissActivity

private void setupToolbar() {
  activity.setSupportActionBar(toolbar);
  if (activity.getSupportActionBar() != null) {
    activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    activity.getSupportActionBar().setHomeAsUpIndicator(R.drawable.dragdismiss_ic_close);
    activity.getSupportActionBar().setTitle(toolbarTitle);
  }
  if (!shouldShowToolbar) {
    toolbar.setVisibility(View.GONE);
  }
  int statusBarHeight = StatusBarHelper.getStatusBarHeight(activity);
  statusBar.getLayoutParams().height = statusBarHeight;
  if (appBarLayout == null) {
    ((CoordinatorLayout.LayoutParams) toolbar.getLayoutParams()).topMargin = statusBarHeight;
  } else {
    ((CoordinatorLayout.LayoutParams) appBarLayout.getLayoutParams()).topMargin = statusBarHeight;
  }
}

代码示例来源:origin: MCMrARM/revolution-irc

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  if (mCustomContentViewId != 0)
    setContentView(mCustomContentViewId);
  else
    setContentView(R.layout.activity_setup_big_header);
  AppBarLayout appBar = findViewById(R.id.appbar);
  CollapsingToolbarLayout toolbarLayout = findViewById(R.id.toolbar_layout);
  Toolbar toolbar = findViewById(R.id.toolbar);
  setSupportActionBar(toolbar);
  mLayout = findViewById(R.id.layout);
  mLayout.getViewTreeObserver().addOnGlobalLayoutListener(() -> {
    int height = mLayout.getHeight();
    CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams)
        appBar.getLayoutParams();
    params.height = height / 3;
    appBar.setLayoutParams(params);
    int childHeight = (mContentView != null ? mContentView.getHeight() : 0);
    if (mContentView instanceof NestedScrollView)
      childHeight = ((NestedScrollView) mContentView).getChildAt(0).getHeight();
    boolean needsScroll = (mContentView != null && childHeight > height - params.height);
    AppBarLayout.LayoutParams paramsToolbar = (AppBarLayout.LayoutParams) toolbarLayout.getLayoutParams();
    paramsToolbar.setScrollFlags(needsScroll
        ? (AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED)
        : 0);
    toolbarLayout.setLayoutParams(paramsToolbar);
  });
}

代码示例来源:origin: LineageOS/android_packages_apps_Jelly

private void changeUiMode(boolean isReachMode) {
  CoordinatorLayout.LayoutParams appBarParams =
      (CoordinatorLayout.LayoutParams) mAppBar.getLayoutParams();
  CoordinatorLayout.LayoutParams containerParams =
      (CoordinatorLayout.LayoutParams) mWebViewContainer.getLayoutParams();

相关文章