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


Java View.OnTouchListener方法代码示例

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


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

示例1: getHapticFeedbackTouchListener

import android.view.View; //导入方法依赖的package包/类
public View.OnTouchListener getHapticFeedbackTouchListener() {
    if (mHapticFeedbackTouchListener == null) {
        mHapticFeedbackTouchListener = new View.OnTouchListener() {
            @SuppressLint("ClickableViewAccessibility")
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if ((event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_DOWN) {
                    v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
                }
                return false;
            }
        };
    }
    return mHapticFeedbackTouchListener;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:16,代码来源:Launcher.java

示例2: changeTextColorOnTouchListener

import android.view.View; //导入方法依赖的package包/类
/**
 * returns OnTouchListener that change color of TextView on touch View.
 * @param context
 * @param textView TextView to change text color
 * @return
 */
public static View.OnTouchListener changeTextColorOnTouchListener(
        final Context context, final TextView textView) {

    return new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
                case MotionEvent.ACTION_DOWN:
                    textView.setTextColor(
                            ContextCompat.getColor(context, R.color.colorPrimary));
                    break;
                case MotionEvent.ACTION_MOVE:
                    Rect rect = new Rect(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
                    if (!rect.contains(
                            v.getLeft() + (int) event.getX(), v.getTop() + (int) event.getY())) {
                        textView.setTextColor(Color.BLACK);
                    }
                    break;
                case MotionEvent.ACTION_UP:
                case MotionEvent.ACTION_CANCEL:
                    textView.setTextColor(Color.BLACK);
                    break;
                default: break;
            }

            return false;
        }
    };
}
 
开发者ID:DSM-DMS,项目名称:DMS,代码行数:36,代码来源:Listeners.java

示例3: setOnTouchListener

import android.view.View; //导入方法依赖的package包/类
public ViewHolder setOnTouchListener(int viewId,
                                     View.OnTouchListener listener)
{
    View view = getView(viewId);
    view.setOnTouchListener(listener);
    return this;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:ViewHolder.java

示例4: StableArrayAdapter

import android.view.View; //导入方法依赖的package包/类
public StableArrayAdapter(Context context, int textViewResourceId,
        List<String> objects, View.OnTouchListener listener) {
    super(context, textViewResourceId, objects);
    mTouchListener = listener;
    for (int i = 0; i < objects.size(); ++i) {
        mIdMap.put(objects.get(i), i);
    }
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:9,代码来源:StableArrayAdapter.java

示例5: onTouch

import android.view.View; //导入方法依赖的package包/类
@Test
public void onTouch() throws Exception {
    // Given
    View.OnTouchListener listener = mock(View.OnTouchListener.class);

    // When
    BlueTapeDsl
            .onTouch(listener)
            .bind(view);

    // Then
    verify(view).setOnTouchListener(listener);
}
 
开发者ID:dmitry-zaitsev,项目名称:BlueTape,代码行数:14,代码来源:BlueTapeDslTest.java

示例6: setOnTouchListener

import android.view.View; //导入方法依赖的package包/类
public XViewHolder setOnTouchListener(@IdRes int viewId,
                                      View.OnTouchListener listener) {
    View view = getView(viewId);
    view.setOnTouchListener(listener);
    return this;
}
 
开发者ID:youth5201314,项目名称:XFrame,代码行数:7,代码来源:XViewHolder.java

示例7: setupTouchUIToDismissKeyboard

import android.view.View; //导入方法依赖的package包/类
public void setupTouchUIToDismissKeyboard(View view, View.OnTouchListener onTouchListener, final Integer... exceptIDs) {
    ChatSDKUiHelper.setupTouchUIToDismissKeyboard(view, onTouchListener, exceptIDs);
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:4,代码来源:ChatSDKBaseActivity.java

示例8: setTouchListenerOnView

import android.view.View; //导入方法依赖的package包/类
private void setTouchListenerOnView(int id, View.OnTouchListener listener) {
	layout.findViewById(id).setOnTouchListener(listener);
}
 
开发者ID:Make-A-Pede,项目名称:Make-A-Pede-Android-App,代码行数:4,代码来源:ArrowKeyFragment.java

示例9: setOnTouchListener

import android.view.View; //导入方法依赖的package包/类
public BaseViewHolder setOnTouchListener(int viewId, View.OnTouchListener listener) {
    View view = getView(viewId);
    view.setOnTouchListener(listener);
    return this;
}
 
开发者ID:yangchong211,项目名称:YCBaseAdapter,代码行数:6,代码来源:BaseViewHolder.java

示例10: setOnTouchListener

import android.view.View; //导入方法依赖的package包/类
public ViewHolder setOnTouchListener(int viewId,
                                     View.OnTouchListener listener) {
    View view = getView(viewId);
    view.setOnTouchListener(listener);
    return this;
}
 
开发者ID:fashare2015,项目名称:MVVM-JueJin,代码行数:7,代码来源:ViewHolder.java

示例11: setOnItemTouchListener

import android.view.View; //导入方法依赖的package包/类
public SuperRecyclerHolder setOnItemTouchListener(boolean isListener,
    @NonNull View.OnTouchListener listener) {
    getItemView().setOnTouchListener(isListener ? listener : null);
    return this;
}
 
开发者ID:qinxiaoguai,项目名称:SuperRecyclerViewAdapter,代码行数:6,代码来源:SuperRecyclerHolder.java

示例12: setTouchIntercepter

import android.view.View; //导入方法依赖的package包/类
public PopupWindowBuilder setTouchIntercepter(View.OnTouchListener touchIntercepter){
    mCustomPopWindow.mOnTouchListener = touchIntercepter;
    return this;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:CustomPopWindow.java

示例13: setOnInterceptTouchListener

import android.view.View; //导入方法依赖的package包/类
public void setOnInterceptTouchListener(View.OnTouchListener listener) {
    mInterceptTouchListener = listener;
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:4,代码来源:CellLayout.java

示例14: setTouchIntercepter

import android.view.View; //导入方法依赖的package包/类
/**
 * 设置触摸拦截
 * @param touchIntercepter  拦截器
 */
public CustomPopupWindow.PopupWindowBuilder setTouchIntercepter(View.OnTouchListener touchIntercepter) {
    this.mCustomPopWindow.mOnTouchListener = touchIntercepter;
    return this;
}
 
开发者ID:yangchong211,项目名称:YCDialog,代码行数:9,代码来源:CustomPopupWindow.java

示例15: setOnTouchListener

import android.view.View; //导入方法依赖的package包/类
@Override
public void setOnTouchListener(View.OnTouchListener l) {
    userTouchListener = l;
}
 
开发者ID:sega4revenge,项目名称:Sega,代码行数:5,代码来源:TouchImageView.java


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