本文整理了Java中android.view.View.getLayerType()
方法的一些代码示例,展示了View.getLayerType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。View.getLayerType()
方法的具体详情如下:
包路径:android.view.View
类名称:View
方法名:getLayerType
暂无
代码示例来源:origin: wangdan/AisenWeiBo
RevealFinishedIceCreamSandwich(RevealAnimator target) {
super(target);
mLayerType = ((View) target).getLayerType();
mFeaturedLayerType = View.LAYER_TYPE_SOFTWARE;
}
代码示例来源:origin: andkulikov/Transitions-Everywhere
@Override
public void onAnimationStart(Animator animator) {
if (AnimatorUtils.hasOverlappingRendering(mView) &&
mView.getLayerType() == View.LAYER_TYPE_NONE) {
mLayerTypeChanged = true;
mView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
}
}
代码示例来源:origin: JingYeoh/FragmentRigger
static boolean shouldRunOnHWLayer(View v, Animation anim) {
return v.getLayerType() == View.LAYER_TYPE_NONE
&& ViewCompat.hasOverlappingRendering(v)
&& modifiesAlpha(anim);
}
代码示例来源:origin: square/assertj-android
@TargetApi(HONEYCOMB)
public S hasLayerType(@ViewLayerType int type) {
isNotNull();
int actualType = actual.getLayerType();
//noinspection ResourceType
assertThat(actualType) //
.overridingErrorMessage("Expected layer type <%s> but was <%s>", layerTypeToString(type),
layerTypeToString(actualType)) //
.isEqualTo(type);
return myself;
}
代码示例来源:origin: robolectric/robolectric
@Test
public void layerType() throws Exception {
assertThat(view.getLayerType()).isEqualTo(View.LAYER_TYPE_NONE);
view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
assertThat(view.getLayerType()).isEqualTo(View.LAYER_TYPE_SOFTWARE);
}
代码示例来源:origin: weexteam/weex-hackernews
/********************************
* end hook Activity life cycle callback
********************************************************/
public void destroy() {
if (WXEnvironment.isApkDebugable() && !WXUtils.isUiThread()) {
throw new WXRuntimeException("[WXComponent] destroy can only be called in main thread");
}
if(mHost!= null && mHost.getLayerType()==View.LAYER_TYPE_HARDWARE) {
mHost.setLayerType(View.LAYER_TYPE_NONE, null);
}
removeAllEvent();
removeStickyStyle();
if (mDomObj != null) {
mDomObj = null;
}
}
代码示例来源:origin: aliumujib/Nibo
RevealFinishedIceCreamSandwich(CircularRevealAnimator target) {
super(target);
mLayerType = ((View) target).getLayerType();
mFeaturedLayerType = View.LAYER_TYPE_SOFTWARE;
}
代码示例来源:origin: kingargyle/adt-leanback-support
public static int getLayerType(View view) {
return view.getLayerType();
}
代码示例来源:origin: onlynight/LSearchView
RevealFinishedIceCreamSandwich(RevealAnimator target, int layerType) {
mReference = new WeakReference<>(target);
mLayerType = ((View) target).getLayerType();
mFeaturedLayerType = layerType;
}
代码示例来源:origin: enricocid/LaunchEnr
public void addView(View v) {
mViewsToLayerTypeMap.put(v, v.getLayerType());
}
代码示例来源:origin: Leaking/WeGit
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
RevealFinishedJellyBeanMr1(RevealAnimator target, Rect bounds) {
mReference = new WeakReference<>(target);
mInvalidateBounds = bounds;
mLayerType = ((View) target).getLayerType();
}
代码示例来源:origin: Leaking/WeGit
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
RevealFinishedIceCreamSandwich(RevealAnimator target, Rect bounds) {
mReference = new WeakReference<>(target);
mInvalidateBounds = bounds;
mLayerType = ((View) target).getLayerType();
}
代码示例来源:origin: Demidong/ClockView
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void manageLayer(View v, boolean enableHardware)
{
if (!API_11)
return;
int layerType = enableHardware ? View.LAYER_TYPE_HARDWARE
: View.LAYER_TYPE_NONE;
if (layerType != v.getLayerType())
v.setLayerType(layerType, null);
}
代码示例来源:origin: Hankkin/TaoSchool
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void manageLayers(float percentOpen) {
if (Build.VERSION.SDK_INT < 11) return;
boolean layer = percentOpen > 0.0f && percentOpen < 1.0f;
final int layerType = layer ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE;
if (layerType != getContent().getLayerType()) {
mHandler.post(new Runnable() {
public void run() {
Log.v(TAG, "changing layerType. hardware? " + (layerType == View.LAYER_TYPE_HARDWARE));
getContent().setLayerType(layerType, null);
getMenu().setLayerType(layerType, null);
if (getSecondaryMenu() != null) {
getSecondaryMenu().setLayerType(layerType, null);
}
}
});
}
}
代码示例来源:origin: enricocid/LaunchEnr
@Override
public void onAnimationStart(Animator animation) {
// Enable all necessary layers
Iterator<Map.Entry<View, Integer>> itr = mViewsToLayerTypeMap.entrySet().iterator();
while (itr.hasNext()) {
Map.Entry<View, Integer> entry = itr.next();
View v = entry.getKey();
entry.setValue(v.getLayerType());
v.setLayerType(View.LAYER_TYPE_HARDWARE, null);
if (v.isAttachedToWindow() && v.getVisibility() == View.VISIBLE) {
v.buildLayer();
}
}
}
代码示例来源:origin: TuGengs/Drosophila_Distinguish
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void manageLayers(float percentOpen) {
if (Build.VERSION.SDK_INT < 11) return;
boolean layer = percentOpen > 0.0f && percentOpen < 1.0f;
final int layerType = layer ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE;
if (layerType != getContent().getLayerType()) {
getHandler().post(new Runnable() {
public void run() {
Log.v(TAG, "changing layerType. hardware? " + (layerType == View.LAYER_TYPE_HARDWARE));
getContent().setLayerType(layerType, null);
getMenu().setLayerType(layerType, null);
if (getSecondaryMenu() != null) {
getSecondaryMenu().setLayerType(layerType, null);
}
}
});
}
}
代码示例来源:origin: com.squareup.assertj/assertj-android
@TargetApi(HONEYCOMB)
public S hasLayerType(@ViewLayerType int type) {
isNotNull();
int actualType = actual.getLayerType();
//noinspection ResourceType
assertThat(actualType) //
.overridingErrorMessage("Expected layer type <%s> but was <%s>", layerTypeToString(type),
layerTypeToString(actualType)) //
.isEqualTo(type);
return myself;
}
代码示例来源:origin: Demidong/ClockView
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void disableHardwareLayer()
{
if (!API_11)
return;
View v;
for (int i = 0; i < getChildCount(); i++)
{
v = getChildAt(i);
if (v.getLayerType() != View.LAYER_TYPE_NONE)
v.setLayerType(View.LAYER_TYPE_NONE, null);
}
}
代码示例来源:origin: andforce/iBeebo
@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
if (mAdapter != null) {
mAdapter.onAnimationStart(animation);
}
mLayerType = mTargetView.getLayerType();
mTargetView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
// AppLogger.d("View animation is started, enable hardware accelerated");
}
代码示例来源:origin: andforce/iBeebo
@Override
public void onPageScrollStateChanged(int scrollState) {
if (scrollState != ViewPager.SCROLL_STATE_IDLE && finalDisableHardwareLayerType) {
final int childCount = mViewPager.getChildCount();
for (int i = 0; i < childCount; i++) {
View child = mViewPager.getChildAt(i);
if (child.getLayerType() != View.LAYER_TYPE_NONE) {
child.setLayerType(View.LAYER_TYPE_NONE, null);
}
}
}
}
});
内容来源于网络,如有侵权,请联系作者删除!