android.support.v7.widget.Toolbar.getPaddingBottom()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(14.1k)|赞(0)|评价(0)|浏览(110)

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

Toolbar.getPaddingBottom介绍

暂无

代码示例

代码示例来源:origin: chaychan/TouTiao

lp.height += statusBarHeight;
toolbar.setLayoutParams(lp);
toolbar.setPadding(toolbar.getPaddingLeft(), toolbar.getPaddingTop() + statusBarHeight, toolbar.getPaddingRight(), toolbar.getPaddingBottom());
toolbar.setTag(true);

代码示例来源:origin: chaychan/TouTiao

lp.height += statusBarHeight;
toolbar.setLayoutParams(lp);
toolbar.setPadding(toolbar.getPaddingLeft(), toolbar.getPaddingTop() + statusBarHeight, toolbar.getPaddingRight(), toolbar.getPaddingBottom());
toolbar.setTag(true);

代码示例来源:origin: chaychan/TouTiao

lp.height += statusBarHeight;
toolbar.setLayoutParams(lp);
toolbar.setPadding(toolbar.getPaddingLeft(), toolbar.getPaddingTop() + statusBarHeight, toolbar.getPaddingRight(), toolbar.getPaddingBottom());
toolbar.setTag(true);

代码示例来源:origin: chaychan/TouTiao

lp.height += statusBarHeight;
toolbar.setLayoutParams(lp);
toolbar.setPadding(toolbar.getPaddingLeft(), toolbar.getPaddingTop() + statusBarHeight, toolbar.getPaddingRight(), toolbar.getPaddingBottom());
toolbar.setTag(true);

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

@Override
  public void onGlobalLayout() {
    toolbar.getViewTreeObserver().removeOnGlobalLayoutListener(this);
    // hacky way of getting window insets on pre-Lollipop
    // somewhat works...
    int[] screenSize = Util.getScreenSize(SetWallpaperActivity.this);
    int[] windowInsets = new int[]{
        Math.abs(screenSize[0] - toolbar.getLeft()),
        Math.abs(screenSize[1] - toolbar.getTop()),
        Math.abs(screenSize[2] - toolbar.getRight()),
        Math.abs(0)};
    toolbar.setPadding(toolbar.getPaddingStart() + windowInsets[0],
        toolbar.getPaddingTop() + windowInsets[1],
        toolbar.getPaddingEnd() + windowInsets[2],
        toolbar.getPaddingBottom());
  }
});

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

@Override
  public void onGlobalLayout() {
    //hacky way of getting window insets on pre-Lollipop
    int[] screenSize = Util.getScreenSize(ExifEditorActivity.this);
    int[] windowInsets = new int[]{
        Math.abs(screenSize[0] - rootView.getLeft()),
        Math.abs(screenSize[1] - rootView.getTop()),
        Math.abs(screenSize[2] - rootView.getRight()),
        Math.abs(screenSize[3] - rootView.getBottom())};
    toolbar.setPadding(toolbar.getPaddingStart() + windowInsets[0],
        toolbar.getPaddingTop() + windowInsets[1],
        toolbar.getPaddingEnd() + windowInsets[2],
        toolbar.getPaddingBottom());
    recyclerView.setPadding(recyclerView.getPaddingStart() + windowInsets[0],
        recyclerView.getPaddingTop(),
        recyclerView.getPaddingEnd() + windowInsets[2],
        recyclerView.getPaddingBottom() + windowInsets[3]);
    rootView.getViewTreeObserver()
        .removeOnGlobalLayoutListener(this);
  }
});

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

@Override
  public void onGlobalLayout() {
    //hacky way of getting window insets on pre-Lollipop
    int[] screenSize = Util.getScreenSize(VirtualAlbumsActivity.this);
    int[] windowInsets = new int[]{
        Math.abs(screenSize[0] - rootView.getLeft()),
        Math.abs(screenSize[1] - rootView.getTop()),
        Math.abs(screenSize[2] - rootView.getRight()),
        Math.abs(screenSize[3] - rootView.getBottom())};
    toolbar.setPadding(toolbar.getPaddingStart() + windowInsets[0],
        toolbar.getPaddingTop() + windowInsets[1],
        toolbar.getPaddingEnd() + windowInsets[2],
        toolbar.getPaddingBottom());
    recyclerView.setPadding(recyclerView.getPaddingStart() + windowInsets[0],
        recyclerView.getPaddingTop(),
        recyclerView.getPaddingEnd() + windowInsets[2],
        recyclerView.getPaddingBottom() + windowInsets[3]);
    rootView.getViewTreeObserver()
        .removeOnGlobalLayoutListener(this);
  }
});

代码示例来源:origin: tyzlmjj/AndroidUI

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_scrolling);
  Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  //设置toolbar高度
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP)
  {
    toolbar.getLayoutParams().height = getAppBarHeight();
    toolbar.setPadding(toolbar.getPaddingLeft(),getStatusBarHeight(),toolbar.getPaddingRight(),toolbar.getPaddingBottom());
  }
  setSupportActionBar(toolbar);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

@Override
  public void onGlobalLayout() {
    //hacky way of getting window insets on pre-Lollipop
    int[] screenSize = Util.getScreenSize(ExcludePathsActivity.this);
    int[] windowInsets = new int[]{
        Math.abs(screenSize[0] - rootView.getLeft()),
        Math.abs(screenSize[1] - rootView.getTop()),
        Math.abs(screenSize[2] - rootView.getRight()),
        Math.abs(screenSize[3] - rootView.getBottom())};
    toolbar.setPadding(toolbar.getPaddingStart() + windowInsets[0],
        toolbar.getPaddingTop() + windowInsets[1],
        toolbar.getPaddingEnd() + windowInsets[2],
        toolbar.getPaddingBottom());
    recyclerView.setPadding(recyclerView.getPaddingStart() + windowInsets[0],
        recyclerView.getPaddingTop(),
        recyclerView.getPaddingEnd() + windowInsets[2],
        recyclerView.getPaddingBottom() + windowInsets[3]);
    rootView.getViewTreeObserver()
        .removeOnGlobalLayoutListener(this);
  }
});

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

@Override
  public void onGlobalLayout() {
    //hacky way of getting window insets on pre-Lollipop
    int[] screenSize = Util.getScreenSize(ItemActivity.this);
    int[] windowInsets = new int[]{
        Math.abs(screenSize[0] - rootView.getLeft()),
        Math.abs(screenSize[1] - rootView.getTop()),
        Math.abs(screenSize[2] - rootView.getRight()),
        Math.abs(screenSize[3] - rootView.getBottom())};
    toolbar.setPadding(toolbar.getPaddingStart() + windowInsets[0],
        toolbar.getPaddingTop() + windowInsets[1],
        toolbar.getPaddingEnd() + windowInsets[2],
        toolbar.getPaddingBottom());
    bottomBar.setPadding(bottomBar.getPaddingStart() + windowInsets[0],
        bottomBar.getPaddingTop(),
        bottomBar.getPaddingEnd() + windowInsets[2],
        bottomBar.getPaddingBottom() + windowInsets[3]);
    rootView.getViewTreeObserver()
        .removeOnGlobalLayoutListener(this);
  }
});

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

@Override
  @RequiresApi(api = Build.VERSION_CODES.KITKAT_WATCH)
  public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) {
    // clear this listener so insets aren't re-applied
    toolbar.setOnApplyWindowInsetsListener(null);
    toolbar.setPadding(toolbar.getPaddingStart() + insets.getSystemWindowInsetLeft(),
        toolbar.getPaddingTop() + insets.getSystemWindowInsetTop(),
        toolbar.getPaddingEnd() + insets.getSystemWindowInsetRight(),
        toolbar.getPaddingBottom());
    return insets.consumeSystemWindowInsets();
  }
});

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

@RequiresApi(api = Build.VERSION_CODES.KITKAT_WATCH)
  @Override
  public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) {
    toolbar.setPadding(toolbar.getPaddingStart() /*+ insets.getSystemWindowInsetLeft()*/,
        toolbar.getPaddingTop() + insets.getSystemWindowInsetTop(),
        toolbar.getPaddingEnd() /*+ insets.getSystemWindowInsetRight()*/,
        toolbar.getPaddingBottom());
    aboutText.setPadding(aboutText.getPaddingStart(),
        aboutText.getPaddingTop(),
        aboutText.getPaddingEnd(),
        aboutText.getPaddingBottom() + insets.getSystemWindowInsetBottom());
    View viewGroup = findViewById(R.id.swipeBackView);
    ViewGroup.MarginLayoutParams viewGroupParams
        = (ViewGroup.MarginLayoutParams) viewGroup.getLayoutParams();
    viewGroupParams.leftMargin += insets.getSystemWindowInsetLeft();
    viewGroupParams.rightMargin += insets.getSystemWindowInsetRight();
    viewGroup.setLayoutParams(viewGroupParams);
    // clear this listener so insets aren't re-applied
    rootView.setOnApplyWindowInsetsListener(null);
    return insets.consumeSystemWindowInsets();
  }
});

代码示例来源:origin: tyzlmjj/AndroidUI

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  mToolbar = (Toolbar) findViewById(R.id.toolbar);
  //设置toolbar高度和内边距
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
  {
    mToolbar.getLayoutParams().height = getAppBarHeight();
    mToolbar.setPadding(mToolbar.getPaddingLeft(),
        getStatusBarHeight(),
        mToolbar.getPaddingRight(),
        mToolbar.getPaddingBottom());
  }
  setSupportActionBar(mToolbar);
  init();
}

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

@Override
  @RequiresApi(api = Build.VERSION_CODES.KITKAT_WATCH)
  public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) {
    toolbar.setPadding(toolbar.getPaddingStart() + insets.getSystemWindowInsetLeft(),
        toolbar.getPaddingTop() + insets.getSystemWindowInsetTop(),
        toolbar.getPaddingEnd() + insets.getSystemWindowInsetRight(),
        toolbar.getPaddingBottom());
    recyclerView.setPadding(recyclerView.getPaddingStart() + insets.getSystemWindowInsetLeft(),
        recyclerView.getPaddingTop(),
        recyclerView.getPaddingEnd() + insets.getSystemWindowInsetRight(),
        recyclerView.getPaddingBottom() + insets.getSystemWindowInsetBottom());
    // clear this listener so insets aren't re-applied
    rootView.setOnApplyWindowInsetsListener(null);
    return insets.consumeSystemWindowInsets();
  }
});

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

@Override
  @RequiresApi(api = Build.VERSION_CODES.KITKAT_WATCH)
  public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) {
    toolbar.setPadding(toolbar.getPaddingStart() + insets.getSystemWindowInsetLeft(),
        toolbar.getPaddingTop() + insets.getSystemWindowInsetTop(),
        toolbar.getPaddingEnd() + insets.getSystemWindowInsetRight(),
        toolbar.getPaddingBottom());
    recyclerView.setPadding(recyclerView.getPaddingStart() + insets.getSystemWindowInsetLeft(),
        recyclerView.getPaddingTop(),
        recyclerView.getPaddingEnd() + insets.getSystemWindowInsetRight(),
        recyclerView.getPaddingBottom() + insets.getSystemWindowInsetBottom());
    // clear this listener so insets aren't re-applied
    rootView.setOnApplyWindowInsetsListener(null);
    return insets.consumeSystemWindowInsets();
  }
});

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

@Override
  @RequiresApi(api = Build.VERSION_CODES.KITKAT_WATCH)
  public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) {
    toolbar.setPadding(toolbar.getPaddingStart() + insets.getSystemWindowInsetLeft(),
        toolbar.getPaddingTop() + insets.getSystemWindowInsetTop(),
        toolbar.getPaddingEnd() + insets.getSystemWindowInsetRight(),
        toolbar.getPaddingBottom());
    bottomBar.setPadding(bottomBar.getPaddingStart() + insets.getSystemWindowInsetLeft(),
        bottomBar.getPaddingTop(),
        bottomBar.getPaddingEnd() + insets.getSystemWindowInsetRight(),
        bottomBar.getPaddingBottom() + insets.getSystemWindowInsetBottom());
    // clear this listener so insets aren't re-applied
    rootView.setOnApplyWindowInsetsListener(null);
    return insets.consumeSystemWindowInsets();
  }
});

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

@Override
  @RequiresApi(api = Build.VERSION_CODES.KITKAT_WATCH)
  public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) {
    toolbar.setPadding(toolbar.getPaddingStart() + insets.getSystemWindowInsetLeft(),
        toolbar.getPaddingTop() + insets.getSystemWindowInsetTop(),
        toolbar.getPaddingEnd() + insets.getSystemWindowInsetRight(),
        toolbar.getPaddingBottom());
    recyclerView.setPadding(recyclerView.getPaddingStart() + insets.getSystemWindowInsetLeft(),
        recyclerView.getPaddingTop(),
        recyclerView.getPaddingEnd() + insets.getSystemWindowInsetRight(),
        recyclerView.getPaddingBottom() + insets.getSystemWindowInsetBottom());
    // clear this listener so insets aren't re-applied
    rootView.setOnApplyWindowInsetsListener(null);
    return insets.consumeSystemWindowInsets();
  }
});

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

@Override
  @RequiresApi(api = Build.VERSION_CODES.KITKAT_WATCH)
  public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) {
    toolbar.setPadding(toolbar.getPaddingStart() /*+ insets.getSystemWindowInsetLeft()*/,
        toolbar.getPaddingTop() + insets.getSystemWindowInsetTop(),
        toolbar.getPaddingEnd() /*+ insets.getSystemWindowInsetRight()*/,
        toolbar.getPaddingBottom());
    ViewGroup.MarginLayoutParams toolbarParams
        = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
    toolbarParams.leftMargin += insets.getSystemWindowInsetLeft();
    toolbarParams.rightMargin += insets.getSystemWindowInsetRight();
    toolbar.setLayoutParams(toolbarParams);
    container.setPadding(container.getPaddingStart() + insets.getSystemWindowInsetLeft(),
        container.getPaddingTop(),
        container.getPaddingEnd() + insets.getSystemWindowInsetRight(),
        container.getPaddingBottom() + insets.getSystemWindowInsetBottom());
    // clear this listener so insets aren't re-applied
    rootView.setOnApplyWindowInsetsListener(null);
    return insets.consumeSystemWindowInsets();
  }
});

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

@Override
  @RequiresApi(api = Build.VERSION_CODES.KITKAT_WATCH)
  public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) {
    // clear this listener so insets aren't re-applied
    rootView.setOnApplyWindowInsetsListener(null);
    toolbar.setPadding(toolbar.getPaddingStart() + insets.getSystemWindowInsetLeft(),
        toolbar.getPaddingTop() + insets.getSystemWindowInsetTop(),
        toolbar.getPaddingEnd() + insets.getSystemWindowInsetRight(),
        toolbar.getPaddingBottom());
    actionArea.setPadding(actionArea.getPaddingStart() + insets.getSystemWindowInsetLeft(),
        actionArea.getPaddingTop(),
        actionArea.getPaddingEnd() + insets.getSystemWindowInsetRight(),
        actionArea.getPaddingBottom() + insets.getSystemWindowInsetBottom());
    imageView.setPadding(imageView.getPaddingStart() + insets.getSystemWindowInsetLeft(),
        imageView.getPaddingTop()/* + insets.getSystemWindowInsetTop()*/,
        imageView.getPaddingEnd() + insets.getSystemWindowInsetRight(),
        imageView.getPaddingBottom()/* + insets.getSystemWindowInsetBottom()*/);
    return insets.consumeSystemWindowInsets();
  }
});

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

@Override
  @RequiresApi(api = Build.VERSION_CODES.KITKAT_WATCH)
  public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) {
    toolbar.setPadding(toolbar.getPaddingStart(),
        toolbar.getPaddingTop() + insets.getSystemWindowInsetTop(),
        toolbar.getPaddingEnd(),
        toolbar.getPaddingBottom());
    ViewGroup.MarginLayoutParams toolbarParams
        = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
    toolbarParams.leftMargin += insets.getSystemWindowInsetLeft();
    toolbarParams.rightMargin += insets.getSystemWindowInsetRight();
    toolbar.setLayoutParams(toolbarParams);
    recyclerView.setPadding(recyclerView.getPaddingStart() + insets.getSystemWindowInsetLeft(),
        recyclerView.getPaddingTop() + insets.getSystemWindowInsetTop(),
        recyclerView.getPaddingEnd() + insets.getSystemWindowInsetRight(),
        recyclerView.getPaddingBottom() + insets.getSystemWindowInsetBottom());
    fab.setTranslationY(-insets.getSystemWindowInsetBottom());
    fab.setTranslationX(-insets.getSystemWindowInsetRight());
    rootView.setOnApplyWindowInsetsListener(null);
    return insets.consumeSystemWindowInsets();
  }
});

相关文章

Toolbar类方法