本文整理汇总了Java中android.graphics.drawable.InsetDrawable.getPadding方法的典型用法代码示例。如果您正苦于以下问题:Java InsetDrawable.getPadding方法的具体用法?Java InsetDrawable.getPadding怎么用?Java InsetDrawable.getPadding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.drawable.InsetDrawable
的用法示例。
在下文中一共展示了InsetDrawable.getPadding方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onUpdateBackgroundAndPaddings
import android.graphics.drawable.InsetDrawable; //导入方法依赖的package包/类
@Override
protected void onUpdateBackgroundAndPaddings(Rect searchBarBounds, Rect padding) {
// Apply the top-bottom padding to the content itself so that the launcher transition is
// clipped correctly
mContent.setPadding(0, padding.top, 0, padding.bottom);
// TODO: Use quantum_panel_dark instead of quantum_panel_shape_dark.
InsetDrawable background = new InsetDrawable(
getResources().getDrawable(R.drawable.quantum_panel_shape_dark), padding.left, 0,
padding.right, 0);
Rect bgPadding = new Rect();
background.getPadding(bgPadding);
mView.setBackground(background);
getRevealView().setBackground(background.getConstantState().newDrawable());
mView.updateBackgroundPadding(bgPadding);
}
示例2: onUpdateBackgroundAndPaddings
import android.graphics.drawable.InsetDrawable; //导入方法依赖的package包/类
private void onUpdateBackgroundAndPaddings(Rect padding) {
// Apply the top-bottom padding to itself so that the launcher transition is
// clipped correctly
setPadding(0, padding.top, 0, padding.bottom);
InsetDrawable background = new InsetDrawable(mRevealDrawable,
padding.left, 0, padding.right, 0);
mRevealView.setBackground(background.getConstantState().newDrawable());
mContent.setBackground(background);
// We let the content have a intent background, but still have full width.
// This allows the scroll bar to be used responsive outside the background bounds as well.
mContent.setPadding(0, 0, 0, 0);
Rect bgPadding = new Rect();
background.getPadding(bgPadding);
onUpdateBgPadding(padding, bgPadding);
}
示例3: getTextLeft
import android.graphics.drawable.InsetDrawable; //导入方法依赖的package包/类
private int getTextLeft() {
int left = 0;
if (getBackground() instanceof InsetDrawable) {
InsetDrawable back = (InsetDrawable) getBackground();
Rect padding = new Rect();
back.getPadding(padding);
left = padding.left;
}
return left;
}
示例4: onUpdateBackgroundAndPaddings
import android.graphics.drawable.InsetDrawable; //导入方法依赖的package包/类
@Override
protected void onUpdateBackgroundAndPaddings(Rect searchBarBounds, Rect padding) {
boolean isRtl = Utilities.isRtl(getResources());
// Apply the top-bottom padding to the content itself so that the launcher transition is
// clipped correctly
mContent.setPadding(0, padding.top, 0, padding.bottom);
// TODO: Use quantum_panel_dark instead of quantum_panel_shape_dark.
InsetDrawable background = new InsetDrawable(
getResources().getDrawable(R.drawable.quantum_panel_shape_dark), padding.left, 0,
padding.right, 0);
Rect bgPadding = new Rect();
background.getPadding(bgPadding);
mView.setBackground(background);
getRevealView().setBackground(background.getConstantState().newDrawable());
mView.updateBackgroundPadding(bgPadding);
int startInset = mView.getMaxScrollbarWidth();
int topBottomPadding = getPaddingTop();
final boolean useScrollerScrubber = useScroller() && useScrubber();
if (isRtl) {
mView.setPadding(padding.left + mView.getMaxScrollbarWidth(),
topBottomPadding, padding.right + startInset, useScrollerScrubber ?
mScrubberHeight + topBottomPadding : topBottomPadding);
if (useScrollerScrubber) {
mScrubberContainerView.setPadding(padding.left, 0, padding.right, 0);
}
} else {
mView.setPadding(padding.left + startInset, topBottomPadding,
padding.right + mView.getMaxScrollbarWidth(), useScrollerScrubber ?
mScrubberHeight + topBottomPadding : topBottomPadding);
if (useScrollerScrubber) {
mScrubberContainerView.setPadding(padding.left, 0, padding.right, 0);
mScrubberContainerView.setEnabled(true);
mScrubberContainerView.bringToFront();
}
}
}
示例5: onUpdateBackgroundAndPaddings
import android.graphics.drawable.InsetDrawable; //导入方法依赖的package包/类
/**
* Update the background and padding of the Apps view and children. Instead of insetting the
* container view, we inset the background and padding of the recycler view to allow for the
* recycler view to handle touch events (for fast scrolling) all the way to the edge.
*/
@Override
protected void onUpdateBackgroundAndPaddings(Rect searchBarBounds, Rect padding) {
boolean isRtl = Utilities.isRtl(getResources());
// TODO: Use quantum_panel instead of quantum_panel_shape
InsetDrawable background = new InsetDrawable(
getResources().getDrawable(R.drawable.quantum_panel_shape), padding.left, 0,
padding.right, 0);
Rect bgPadding = new Rect();
background.getPadding(bgPadding);
mContainerView.setBackground(background);
mRevealView.setBackground(background.getConstantState().newDrawable());
mAppsRecyclerView.updateBackgroundPadding(bgPadding);
mAdapter.updateBackgroundPadding(bgPadding);
// Hack: We are going to let the recycler view take the full width, so reset the padding on
// the container to zero after setting the background and apply the top-bottom padding to
// the content view instead so that the launcher transition clips correctly.
mContent.setPadding(0, padding.top, 0, padding.bottom);
mContainerView.setPadding(0, 0, 0, 0);
// Pad the recycler view by the background padding plus the start margin (for the section
// names)
int startInset = Math.max(mSectionNamesMargin, mAppsRecyclerView.getMaxScrollbarWidth());
int topBottomPadding = mRecyclerViewTopBottomPadding;
if (isRtl) {
mAppsRecyclerView.setPadding(padding.left + mAppsRecyclerView.getMaxScrollbarWidth(),
topBottomPadding, padding.right + startInset, topBottomPadding);
} else {
mAppsRecyclerView.setPadding(padding.left + startInset, topBottomPadding,
padding.right + mAppsRecyclerView.getMaxScrollbarWidth(), topBottomPadding);
}
// Inset the search bar to fit its bounds above the container
if (mSearchBarView != null) {
Rect backgroundPadding = new Rect();
if (mSearchBarView.getBackground() != null) {
mSearchBarView.getBackground().getPadding(backgroundPadding);
}
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams)
mSearchBarContainerView.getLayoutParams();
lp.leftMargin = searchBarBounds.left - backgroundPadding.left;
lp.topMargin = searchBarBounds.top - backgroundPadding.top;
lp.rightMargin = (getMeasuredWidth() - searchBarBounds.right) - backgroundPadding.right;
mSearchBarContainerView.requestLayout();
}
}
示例6: onUpdateBackgroundAndPaddings
import android.graphics.drawable.InsetDrawable; //导入方法依赖的package包/类
/**
* Update the background and padding of the Apps view and children. Instead of insetting the
* container view, we inset the background and padding of the recycler view to allow for the
* recycler view to handle touch events (for fast scrolling) all the way to the edge.
*/
@Override
protected void onUpdateBackgroundAndPaddings(Rect searchBarBounds, Rect padding) {
boolean isRtl = Utilities.isRtl(getResources());
// TODO: Use quantum_panel instead of quantum_panel_shape
int bgRes = mGridTheme == GRID_THEME_DARK ? R.drawable.quantum_panel_shape_dark :
R.drawable.quantum_panel_shape;
InsetDrawable background = new InsetDrawable(
getResources().getDrawable(bgRes), padding.left, 0,
padding.right, 0);
Rect bgPadding = new Rect();
background.getPadding(bgPadding);
mContainerView.setBackground(background);
mRevealView.setBackground(background.getConstantState().newDrawable());
mAppsRecyclerView.updateBackgroundPadding(bgPadding);
mAdapter.updateBackgroundPadding(bgPadding);
// Hack: We are going to let the recycler view take the full width, so reset the padding on
// the container to zero after setting the background and apply the top-bottom padding to
// the content view instead so that the launcher transition clips correctly.
mContent.setPadding(0, padding.top, 0, padding.bottom);
mContainerView.setPadding(0, 0, 0, 0);
// Pad the recycler view by the background padding plus the start margin (for the section
// names)
int startInset = Math.max(mSectionNamesMargin, mAppsRecyclerView.getMaxScrollbarWidth());
int topBottomPadding = mRecyclerViewTopBottomPadding;
final boolean useScrollerScrubber = useScroller() && useScrubber();
if (isRtl) {
mAppsRecyclerView.setPadding(padding.left + mAppsRecyclerView.getMaxScrollbarWidth(),
topBottomPadding, padding.right + startInset, useScrollerScrubber ?
mScrubberHeight + topBottomPadding : topBottomPadding);
if (useScrollerScrubber) {
mScrubberContainerView.setPadding(padding.left +
mAppsRecyclerView.getMaxScrollbarWidth(), 0, padding.right, 0);
}
} else {
mAppsRecyclerView.setPadding(padding.left + startInset, topBottomPadding,
padding.right + mAppsRecyclerView.getMaxScrollbarWidth(), useScrollerScrubber ?
mScrubberHeight + topBottomPadding : topBottomPadding);
if (useScrollerScrubber) {
mScrubberContainerView.setPadding(padding.left, 0,
padding.right + mAppsRecyclerView.getMaxScrollbarWidth(), 0);
}
}
// Inset the search bar to fit its bounds above the container
if (mSearchBarView != null) {
Rect backgroundPadding = new Rect();
if (mSearchBarView.getBackground() != null) {
mSearchBarView.getBackground().getPadding(backgroundPadding);
}
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams)
mSearchBarContainerView.getLayoutParams();
lp.leftMargin = searchBarBounds.left - backgroundPadding.left;
lp.topMargin = searchBarBounds.top - backgroundPadding.top;
lp.rightMargin = (getMeasuredWidth() - searchBarBounds.right)
- backgroundPadding.right;
mSearchBarContainerView.requestLayout();
}
}