当前位置: 首页>>代码示例>>Java>>正文


Java ViewCompat.hasOnClickListeners方法代码示例

本文整理汇总了Java中android.support.v4.view.ViewCompat.hasOnClickListeners方法的典型用法代码示例。如果您正苦于以下问题:Java ViewCompat.hasOnClickListeners方法的具体用法?Java ViewCompat.hasOnClickListeners怎么用?Java ViewCompat.hasOnClickListeners使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.view.ViewCompat的用法示例。


在下文中一共展示了ViewCompat.hasOnClickListeners方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkOnClickListener

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
 * android:onClick doesn't handle views with a ContextWrapper context. This method
 * backports new framework functionality to traverse the Context wrappers to find a
 * suitable target.
 */
private void checkOnClickListener(View view, AttributeSet attrs) {
    final Context context = view.getContext();

    if (!(context instanceof ContextWrapper) ||
            (Build.VERSION.SDK_INT >= 15 && !ViewCompat.hasOnClickListeners(view))) {
        // Skip our compat functionality if: the Context isn't a ContextWrapper, or
        // the view doesn't have an OnClickListener (we can only rely on this on API 15+ so
        // always use our compat code on older devices)
        return;
    }

    final TypedArray a = context.obtainStyledAttributes(attrs, sOnClickAttrs);
    final String handlerName = a.getString(0);
    if (handlerName != null) {
        view.setOnClickListener(new DeclaredOnClickListener(view, handlerName));
    }
    a.recycle();
}
 
开发者ID:wutongke,项目名称:AndroidSkinAnimator,代码行数:24,代码来源:SkinCompatViewInflater.java

示例2: onChildAttachedToWindow

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void onChildAttachedToWindow(View child) {
    super.onChildAttachedToWindow(child);
    if (!ViewCompat.hasOnClickListeners(child)) {
        child.setClickable(true);
        child.setOnClickListener(mOnItemOperateListenerInternalInternal);
    }
    child.setOnLongClickListener(mOnItemOperateListenerInternalInternal);
}
 
开发者ID:littleloulou,项目名称:PullToRefreshRecyclerView,代码行数:10,代码来源:PullToRefreshRecyclerView.java

示例3: checkOnClickListener

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
 * android:onClick doesn't handle views with a ContextWrapper context. This method
 * backports new framework functionality to traverse the Context wrappers to find a
 * suitable target.
 */
private void checkOnClickListener(View view, AttributeSet attrs) {
    final Context context = view.getContext();

    if (!(context instanceof ContextWrapper) ||
            (Build.VERSION.SDK_INT >= 15 && !ViewCompat.hasOnClickListeners(view))) {
        // Skip our compat functionality if: the Context isn't a ContextWrapper, or
        // the view doesn't have an OnClickListener (we can only rely on this on API 15+ so
        // always use our compat code on older devices)
        return;
    }

    final TypedArray a = context.obtainStyledAttributes(attrs, sOnClickAttrs);
    final String handlerName = a.getString(0);
    if (handlerName != null) {
        view.setOnClickListener(new SkinAppCompatViewInflater.DeclaredOnClickListener(view, handlerName));
    }
    a.recycle();
}
 
开发者ID:chengkun123,项目名称:ReadMark,代码行数:24,代码来源:SkinAppCompatViewInflater.java

示例4: checkOnClickListener

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void checkOnClickListener(View view, AttributeSet attrs) {
    Context context = view.getContext();
    if (!(context instanceof ContextWrapper)) {
        return;
    }
    if (VERSION.SDK_INT < 15 || ViewCompat.hasOnClickListeners(view)) {
        TypedArray a = context.obtainStyledAttributes(attrs, sOnClickAttrs);
        String handlerName = a.getString(0);
        if (handlerName != null) {
            view.setOnClickListener(new DeclaredOnClickListener(view, handlerName));
        }
        a.recycle();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:15,代码来源:AppCompatViewInflater.java


注:本文中的android.support.v4.view.ViewCompat.hasOnClickListeners方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。