本文整理汇总了Java中android.support.v4.graphics.drawable.DrawableCompat.setLayoutDirection方法的典型用法代码示例。如果您正苦于以下问题:Java DrawableCompat.setLayoutDirection方法的具体用法?Java DrawableCompat.setLayoutDirection怎么用?Java DrawableCompat.setLayoutDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.graphics.drawable.DrawableCompat
的用法示例。
在下文中一共展示了DrawableCompat.setLayoutDirection方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setStatusBarScrim
import android.support.v4.graphics.drawable.DrawableCompat; //导入方法依赖的package包/类
/**
* Set the drawable to use for the status bar scrim from resources.
* Providing null will disable the scrim functionality.
* <p>
* <p>This scrim is only shown when we have been given a top system inset.</p>
*
* @param drawable the drawable to display
* @see #getStatusBarScrim()
*/
public void setStatusBarScrim(@Nullable Drawable drawable) {
if (mStatusBarScrim != drawable) {
if (mStatusBarScrim != null) {
mStatusBarScrim.setCallback(null);
}
mStatusBarScrim = drawable != null ? drawable.mutate() : null;
if (mStatusBarScrim != null) {
if (mStatusBarScrim.isStateful()) {
mStatusBarScrim.setState(getDrawableState());
}
DrawableCompat.setLayoutDirection(mStatusBarScrim,
ViewCompat.getLayoutDirection(this));
mStatusBarScrim.setVisible(getVisibility() == VISIBLE, false);
mStatusBarScrim.setCallback(this);
mStatusBarScrim.setAlpha(mScrimAlpha);
}
ViewCompat.postInvalidateOnAnimation(this);
}
}
示例2: setStatusBarBackground
import android.support.v4.graphics.drawable.DrawableCompat; //导入方法依赖的package包/类
/**
* Set a drawable to draw in the insets area for the status bar.
* Note that this will only be activated if this DrawerLayout fitsSystemWindows.
*
* @param bg Background drawable to draw behind the status bar
*/
public void setStatusBarBackground(@Nullable final Drawable bg) {
if (mStatusBarBackground != bg) {
if (mStatusBarBackground != null) {
mStatusBarBackground.setCallback(null);
}
mStatusBarBackground = bg != null ? bg.mutate() : null;
if (mStatusBarBackground != null) {
if (mStatusBarBackground.isStateful()) {
mStatusBarBackground.setState(getDrawableState());
}
DrawableCompat.setLayoutDirection(mStatusBarBackground,
ViewCompat.getLayoutDirection(this));
mStatusBarBackground.setVisible(getVisibility() == VISIBLE, false);
mStatusBarBackground.setCallback(this);
}
ViewCompat.postInvalidateOnAnimation(this);
}
}
示例3: setStatusBarBackground
import android.support.v4.graphics.drawable.DrawableCompat; //导入方法依赖的package包/类
public void setStatusBarBackground(@Nullable Drawable bg) {
Drawable drawable = null;
if (this.mStatusBarBackground != bg) {
if (this.mStatusBarBackground != null) {
this.mStatusBarBackground.setCallback(null);
}
if (bg != null) {
drawable = bg.mutate();
}
this.mStatusBarBackground = drawable;
if (this.mStatusBarBackground != null) {
if (this.mStatusBarBackground.isStateful()) {
this.mStatusBarBackground.setState(getDrawableState());
}
DrawableCompat.setLayoutDirection(this.mStatusBarBackground, ViewCompat.getLayoutDirection(this));
this.mStatusBarBackground.setVisible(getVisibility() == 0, false);
this.mStatusBarBackground.setCallback(this);
}
ViewCompat.postInvalidateOnAnimation(this);
}
}
示例4: setStatusBarScrim
import android.support.v4.graphics.drawable.DrawableCompat; //导入方法依赖的package包/类
public void setStatusBarScrim(@Nullable Drawable drawable) {
Drawable drawable2 = null;
if (this.mStatusBarScrim != drawable) {
if (this.mStatusBarScrim != null) {
this.mStatusBarScrim.setCallback(null);
}
if (drawable != null) {
drawable2 = drawable.mutate();
}
this.mStatusBarScrim = drawable2;
if (this.mStatusBarScrim != null) {
if (this.mStatusBarScrim.isStateful()) {
this.mStatusBarScrim.setState(getDrawableState());
}
DrawableCompat.setLayoutDirection(this.mStatusBarScrim, ViewCompat.getLayoutDirection(this));
this.mStatusBarScrim.setVisible(getVisibility() == 0, false);
this.mStatusBarScrim.setCallback(this);
this.mStatusBarScrim.setAlpha(this.mScrimAlpha);
}
ViewCompat.postInvalidateOnAnimation(this);
}
}
示例5: mirror
import android.support.v4.graphics.drawable.DrawableCompat; //导入方法依赖的package包/类
private boolean mirror(Drawable drawable, int layoutDirection) {
if (drawable == null || !DrawableCompat.isAutoMirrored(drawable)) {
return false;
}
DrawableCompat.setLayoutDirection(drawable, layoutDirection);
return true;
}